summaryrefslogtreecommitdiffstats
path: root/misc/xml/format.xsl
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-09-24 04:28:45 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-09-24 04:28:45 +0200
commit08a01723af9cd52c078d5ca6c38c34d375b39fa0 (patch)
tree6eadea9c67f4bb56a9e4ee09f4982efaf61deece /misc/xml/format.xsl
parent924adedb2928f5657c6668f606dbb3294b3c45da (diff)
parentae7f83a7948d8c3760f8019899a45e6ec90c2c6a (diff)
downloadpcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.gz
pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.bz2
pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.xz
pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.zip
Finalyze XML support and provide initial support for views (only descriptions so far)
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>