summaryrefslogtreecommitdiff
path: root/xslt/xfree86.xsl
blob: 1c88e9e27c9d018a16e96ca50b30b22f08e1585a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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>