Debian Codegraph @

helper/xsl_to_v74/convert46to47.xsl

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method="xml"
5 indent="yes" omit-xml-declaration="no" encoding="utf-8"/>
6 <xsl:strip-space elements="type"/>
7
8 <!-- default rule -->
9 <xsl:template match="*" mode="conv46to47">
10 <xsl:copy>
11 <xsl:copy-of select="@*"/>
12 <xsl:apply-templates mode="conv46to47"/>
13 </xsl:copy>
14 </xsl:template>
15
16 <!-- version update -->
17 <para xmlns="http://docbook.org/ns/docbook">
18 Changed attribute <tag class="attribute">schemaversion</tag>
19 to <tag class="attribute">schemaversion</tag> from
20 <literal>4.6</literal> to <literal>4.7</literal>.
21 </para>
22 <xsl:template match="image" mode="conv46to47">
23 <xsl:choose>
24 <!-- nothing to do if already at 4.7 -->
25 <xsl:when test="@schemaversion > 4.6">
26 <xsl:copy-of select="."/>
27 </xsl:when>
28 <!-- otherwise apply templates -->
29 <xsl:otherwise>
30 <image schemaversion="4.7">
31 <xsl:copy-of select="@*[local-name() != 'schemaversion']"/>
32 <xsl:apply-templates mode="conv46to47"/>
33 </image>
34 </xsl:otherwise>
35 </xsl:choose>
36 </xsl:template>
37
38 <!-- toplevel processing instructions and comments -->
39 <xsl:template match="processing-instruction()|comment()" mode="conv46to47">
40 <xsl:copy>
41 <xsl:copy-of select="@*"/>
42 <xsl:apply-templates mode="conv46to47"/>
43 </xsl:copy>
44 </xsl:template>
45
46 <!-- turn vmwareconfig into machine, ignore usb attribute -->
47 <xsl:template match="vmwareconfig" mode="conv46to47">
48 <machine>
49 <xsl:copy-of select="@*[not(local-name(.) = 'usb')]"/>
50 <xsl:apply-templates mode="conv46to47"/>
51 </machine>
52 </xsl:template>
53
54 <!-- turn xenconfig into machine -->
55 <xsl:template match="xenconfig" mode="conv46to47">
56 <machine>
57 <xsl:copy-of select="@*"/>
58 <xsl:apply-templates mode="conv46to47"/>
59 </machine>
60 </xsl:template>
61
62 <!-- turn vmwaredisk into vmdisk -->
63 <xsl:template match="vmwareconfig/vmwaredisk" mode="conv46to47">
64 <vmdisk>
65 <xsl:copy-of select="@*"/>
66 <xsl:apply-templates mode="conv46to47"/>
67 </vmdisk>
68 </xsl:template>
69
70 <!-- turn vmwarenic into vmnic -->
71 <xsl:template match="vmwareconfig/vmwarenic" mode="conv46to47">
72 <vmnic>
73 <xsl:copy-of select="@*"/>
74 <xsl:apply-templates mode="conv46to47"/>
75 </vmnic>
76 </xsl:template>
77
78 <!-- turn vmwarecdrom into vmdvd -->
79 <xsl:template match="vmwareconfig/vmwarecdrom" mode="conv46to47">
80 <vmdvd>
81 <xsl:copy-of select="@*"/>
82 <xsl:apply-templates mode="conv46to47"/>
83 </vmdvd>
84 </xsl:template>
85
86 <!-- turn xenbridge into vmnic -->
87 <xsl:template match="xenconfig/xenbridge" mode="conv46to47">
88 <xsl:variable name="iface" select="@name"/>
89 <vmnic>
90 <xsl:attribute name="interface">
91 <xsl:value-of select="$iface"/>
92 </xsl:attribute>
93 <xsl:copy-of select="@mac"/>
94 <xsl:apply-templates mode="conv46to47"/>
95 </vmnic>
96 </xsl:template>
97
98 <!-- turn xendisk into vmdisk -->
99 <xsl:template match="xenconfig/xendisk" mode="conv46to47">
100 <vmdisk>
101 <xsl:attribute name="controller">
102 <xsl:text>ide</xsl:text>
103 </xsl:attribute>
104 <xsl:attribute name="id">
105 <xsl:text>0</xsl:text>
106 </xsl:attribute>
107 <xsl:copy-of select="@*"/>
108 <xsl:apply-templates mode="conv46to47"/>
109 </vmdisk>
110 </xsl:template>
111
112 <!-- turn format="iso" into installiso and format="usb" into installstick -->
113 <xsl:template match="type" mode="conv46to47">
114 <type>
115 <xsl:copy-of select="@*[not(local-name(.) = 'format')]"/>
116 <xsl:choose>
117 <xsl:when test="@format='iso'">
118 <xsl:attribute name="installiso">
119 <xsl:text>true</xsl:text>
120 </xsl:attribute>
121 </xsl:when>
122 <xsl:when test="@format='usb'">
123 <xsl:attribute name="installstick">
124 <xsl:text>true</xsl:text>
125 </xsl:attribute>
126 </xsl:when>
127 <xsl:otherwise>
128 <xsl:copy-of select="@format"/>
129 </xsl:otherwise>
130 </xsl:choose>
131 <xsl:apply-templates mode="conv46to47"/>
132 </type>
133 </xsl:template>
134
135 </xsl:stylesheet>