Debian Codegraph @

helper/xsl_to_v74/convert49to50.xsl

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:output method="xml"
4 indent="yes" omit-xml-declaration="no" encoding="utf-8"/>
5
6 <!-- default rule -->
7 <xsl:template match="*" mode="conv49to50">
8 <xsl:copy>
9 <xsl:copy-of select="@*"/>
10 <xsl:apply-templates mode="conv49to50"/>
11 </xsl:copy>
12 </xsl:template>
13
14 <!-- version update -->
15 <para xmlns="http://docbook.org/ns/docbook">
16 Changed attribute <tag class="attribute">schemaversion</tag>
17 to <tag class="attribute">schemaversion</tag> from
18 <literal>4.9</literal> to <literal>5.0</literal>.
19 </para>
20 <xsl:template match="image" mode="conv49to50">
21 <xsl:choose>
22 <!-- nothing to do if already at 5.0 -->
23 <xsl:when test="@schemaversion > 4.9">
24 <xsl:copy-of select="."/>
25 </xsl:when>
26 <!-- otherwise apply templates -->
27 <xsl:otherwise>
28 <image schemaversion="5.0">
29 <xsl:copy-of select="@*[local-name() != 'schemaversion']"/>
30 <xsl:apply-templates mode="conv49to50"/>
31 </image>
32 </xsl:otherwise>
33 </xsl:choose>
34 </xsl:template>
35
36 <!-- toplevel processing instructions and comments -->
37 <xsl:template match="processing-instruction()|comment()" mode="conv49to50">
38 <xsl:copy>
39 <xsl:copy-of select="@*"/>
40 <xsl:apply-templates mode="conv49to50"/>
41 </xsl:copy>
42 </xsl:template>
43
44 <!-- convert xen image type to vmx -->
45 <xsl:template match="type" mode="conv49to50">
46 <type>
47 <xsl:choose>
48 <xsl:when test="@image='xen'">
49 <xsl:copy-of select="@*[not(local-name(.) = 'image')]"/>
50 <xsl:attribute name="image">
51 <xsl:text>vmx</xsl:text>
52 </xsl:attribute>
53 <xsl:attribute name="bootkernel">
54 <xsl:text>xenk</xsl:text>
55 </xsl:attribute>
56 <xsl:attribute name="bootprofile">
57 <xsl:text>xen</xsl:text>
58 </xsl:attribute>
59 <xsl:choose>
60 <xsl:when test="starts-with(@boot,'xenboot')">
61 <xsl:variable name="bootpath" select="concat('vmxboot',substring(@boot,8))"/>
62 <xsl:attribute name="boot">
63 <xsl:value-of select="$bootpath"/>
64 </xsl:attribute>
65 </xsl:when>
66 <xsl:otherwise>
67 <xsl:copy-of select="@boot"/>
68 </xsl:otherwise>
69 </xsl:choose>
70 <xsl:apply-templates mode="conv49to50"/>
71 </xsl:when>
72 <xsl:otherwise>
73 <xsl:copy-of select="@*"/>
74 <xsl:apply-templates mode="conv49to50"/>
75 </xsl:otherwise>
76 </xsl:choose>
77 </type>
78 </xsl:template>
79
80 <!-- add domain="domU" to machine section if parent is in xen mode -->
81 <xsl:template match="type/machine" mode="conv49to50">
82 <machine>
83 <xsl:choose>
84 <xsl:when test="../@image='xen'">
85 <xsl:attribute name="domain">
86 <xsl:text>domU</xsl:text>
87 </xsl:attribute>
88 <xsl:copy-of select="@*"/>
89 <xsl:apply-templates mode="conv49to50"/>
90 </xsl:when>
91 <xsl:otherwise>
92 <xsl:copy-of select="@*"/>
93 <xsl:apply-templates mode="conv49to50"/>
94 </xsl:otherwise>
95 </xsl:choose>
96 </machine>
97 </xsl:template>
98
99 </xsl:stylesheet>