summaryrefslogtreecommitdiffstats
path: root/misc/xml/format.xsl
diff options
context:
space:
mode:
Diffstat (limited to 'misc/xml/format.xsl')
-rw-r--r--misc/xml/format.xsl44
1 files changed, 44 insertions, 0 deletions
diff --git a/misc/xml/format.xsl b/misc/xml/format.xsl
new file mode 100644
index 0000000..92abcbb
--- /dev/null
+++ b/misc/xml/format.xsl
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:template match="register|field">
+ <xsl:if test="local-name() = 'field'">
+ <xsl:value-of select="preceding-sibling::text()"/>
+ </xsl:if>
+
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates select="@*"/>
+ <xsl:for-each select="view">
+ <xsl:copy>
+ <xsl:apply-templates select="@*"/>
+ </xsl:copy>
+ </xsl:for-each>
+ <xsl:apply-templates select="field"/>
+ <xsl:if test="field">
+ <xsl:value-of select="text()[last()]"/>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template match="//model/bank|//model/transform|//model/enum|//model/unit">
+ <xsl:value-of select="preceding-sibling::text()"/>
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="model">
+ <xsl:copy>
+ <xsl:apply-templates select="bank"/>
+ <xsl:apply-templates select="transform"/>
+ <xsl:apply-templates select="enum"/>
+ <xsl:apply-templates select="unit"/>
+ <xsl:value-of select="text()[last()]"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>