summaryrefslogtreecommitdiff
path: root/config/ia/setversion.xsl
blob: b81a21fdc0774d7ac81b1562941ea2eaaf66bc87 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8"
    doctype-public="-//W3C//DTD XHTML 1.1//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    indent="yes"/>

  <!-- ##################### Match Rules ####################### -->

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>


  <!-- ELEMENT object -->

  <xsl:template match="object">
    <xsl:text disable-output-escaping="yes"><![CDATA[<object]]></xsl:text>
    <xsl:for-each select="@*">
      <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
      <xsl:value-of select="name()"/>
      <xsl:text disable-output-escaping="yes"><![CDATA[="]]></xsl:text><xsl:value-of select="."/><xsl:text disable-output-escaping="yes"><![CDATA["]]></xsl:text>
    </xsl:for-each>
    <xsl:choose>
    <xsl:when test=".!=''">
      <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes"><![CDATA[</object>]]></xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text disable-output-escaping="yes"><![CDATA[/>]]></xsl:text>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- ELEMENT property -->

  <xsl:template match="property">
    <xsl:choose>
    <xsl:when test="@name='productVersionMajor'">
      <xsl:variable
        name="major"
        select="substring-before($version,'.')">
      </xsl:variable>
      <property name="productVersionMajor">
        <int><xsl:value-of select="$major"/></int>
      </property>
    </xsl:when>
    <xsl:when test="@name='productVersionMinor'">
      <xsl:variable
        name="minor"
        select="substring-before(substring-after($version,'.'),'.')">
      </xsl:variable>
      <property name="productVersionMinor">
        <int><xsl:value-of select="$minor"/></int>
      </property>
    </xsl:when>
    <xsl:when test="@name='productVersionRevision'">
      <xsl:variable
        name="revision"
        select="substring-before(substring-after(substring-after($version,'.'),'.'),'.')">
      </xsl:variable>
      <property name="productVersionRevision">
        <int><xsl:value-of select="$revision"/></int>
      </property>
    </xsl:when>
    <xsl:when test="@name='productVersionSubRevision'">
      <xsl:variable
        name="subrevision"
        select="substring-after(substring-after(substring-after($version,'.'),'.'),'.')">
      </xsl:variable>
      <property name="productVersionSubRevision">
        <int><xsl:value-of select="$subrevision"/></int>
      </property>
    </xsl:when>
    <xsl:otherwise>
      <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
      </xsl:copy>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- ELEMENT restorationObjects -->

  <xsl:template match="restorationObjects">
    <xsl:text disable-output-escaping="yes"><![CDATA[<restorationObjects]]></xsl:text>
    <xsl:for-each select="@*">
      <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
      <xsl:value-of select="name()"/>
      <xsl:text disable-output-escaping="yes"><![CDATA[="]]></xsl:text><xsl:value-of select="."/><xsl:text disable-output-escaping="yes"><![CDATA["]]></xsl:text>
    </xsl:for-each>
    <xsl:choose>
    <xsl:when test=".!=''">
      <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes"><![CDATA[</restorationObjects>]]></xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text disable-output-escaping="yes"><![CDATA[/>]]></xsl:text>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- ELEMENT string -->

  <xsl:template match="string">
    <string><xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>![CDATA[<xsl:value-of select="." disable-output-escaping="yes"/>]]<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text></string>
  </xsl:template>


  <!-- ELEMENT versionID -->

  <xsl:template match="versionID">
    <xsl:text disable-output-escaping="yes"><![CDATA[<versionID]]></xsl:text>
    <xsl:for-each select="@*">
      <xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
      <xsl:value-of select="name()"/>
      <xsl:text disable-output-escaping="yes"><![CDATA[="]]></xsl:text><xsl:value-of select="."/><xsl:text disable-output-escaping="yes"><![CDATA["]]></xsl:text>
    </xsl:for-each>
    <xsl:choose>
    <xsl:when test=".!=''">
      <xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
      <xsl:apply-templates/>
      <xsl:text disable-output-escaping="yes"><![CDATA[</versionID>]]></xsl:text>
    </xsl:when>
    <xsl:otherwise>
      <xsl:text disable-output-escaping="yes"><![CDATA[/>]]></xsl:text>
    </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- otherwise -->

  <xsl:template match="*">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>