summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorsvu <svu>2003-12-05 11:37:13 +0000
committersvu <svu>2003-12-05 11:37:13 +0000
commit887d1553812f4bfb368425f1504501fcc8b436e1 (patch)
treeb0f42ad8e23e8248abd168aafccddf1afebeb221 /xslt
parent09a6e82a74d7764d659ee34fb6e82f37d68074a0 (diff)
downloadxkeyboard-config-887d1553812f4bfb368425f1504501fcc8b436e1.tar.gz
xkeyboard-config-887d1553812f4bfb368425f1504501fcc8b436e1.tar.bz2
xkeyboard-config-887d1553812f4bfb368425f1504501fcc8b436e1.zip
helper xslt - reduces the resulting file
Diffstat (limited to 'xslt')
-rw-r--r--xslt/xfree86.xsl50
1 files changed, 50 insertions, 0 deletions
diff --git a/xslt/xfree86.xsl b/xslt/xfree86.xsl
new file mode 100644
index 00000000..1c88e9e2
--- /dev/null
+++ b/xslt/xfree86.xsl
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+<xsl:output method="xml"
+ encoding="UTF-8"
+ doctype-system="xkb.dtd"
+ indent="yes"/>
+
+ <!-- Transform all "simple" elements as they are -->
+ <xsl:template match="@*|xkbConfigRegistry|layout|layoutList|model|modelList|group|option|optionList|variant|variantList">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|*"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Tricky business: configItem -->
+ <xsl:template match="configItem">
+ <configItem xsl:space="preserve">
+ <name><xsl:value-of select="./name"/></name>
+ <!-- If there are some shortDescriptions -->
+ <xsl:if test="count(./shortDescription)!=0">
+ <!-- First, put the non-translated version -->
+ <shortDescription><xsl:value-of select="./shortDescription[@xml:lang='']"/></shortDescription>
+ <!-- For all translated versions ... -->
+ <xsl:for-each select="./shortDescription[@xml:lang!='']">
+ <!-- ... which are different from non-translated one ... -->
+ <xsl:if test="../shortDescription[@xml:lang='']/text() != ./text()">
+ <!-- ... - output! -->
+ <shortDescription xml:lang="{./@xml:lang}"><xsl:value-of select="./text()"/></shortDescription>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <!-- If there are some descriptions -->
+ <xsl:if test="count(./description)!=0">
+ <!-- First, put the non-translated version -->
+ <description><xsl:value-of select="./description[@xml:lang='']"/></description>
+ <!-- For all translated versions ... -->
+ <xsl:for-each select="./description[@xml:lang!='']">
+ <!-- ... which are different from non-translated one ... -->
+ <xsl:if test="../description[@xml:lang='']/text() != ./text()">
+ <!-- ... - output! -->
+ <description xml:lang="{./@xml:lang}"><xsl:value-of select="./text()"/></description>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </configItem>
+ </xsl:template>
+
+</xsl:stylesheet>