Debian Codegraph @

helper/xsl_to_v74/convert14to20.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="conv14to20">
10 <xsl:copy>
11 <xsl:copy-of select="@*"/>
12 <xsl:apply-templates mode="conv14to20"/>
13 </xsl:copy>
14 </xsl:template>
15
16 <!-- version update -->
17 <para xmlns="http://docbook.org/ns/docbook">
18 Changed attribute <tag class="attribute">schemeversion</tag>
19 from <literal>1.4</literal> to <literal>2.0</literal>.
20 </para>
21 <xsl:template match="image" mode="conv14to20">
22 <xsl:choose>
23 <!-- nothing to do if already at 2.0 -->
24 <xsl:when test="@schemeversion > 1.4 or @schemaversion > 1.4">
25 <xsl:copy-of select="."/>
26 </xsl:when>
27 <!-- otherwise apply templates -->
28 <xsl:otherwise>
29 <image schemeversion="2.0">
30 <xsl:copy-of select="@*[local-name() != 'schemeversion']"/>
31 <xsl:apply-templates mode="conv14to20"/>
32 </image>
33 </xsl:otherwise>
34 </xsl:choose>
35 </xsl:template>
36
37 <!-- toplevel processing instructions and comments -->
38 <xsl:template match="processing-instruction()|comment()" mode="conv14to20">
39 <xsl:copy>
40 <xsl:copy-of select="@*"/>
41 <xsl:apply-templates mode="conv14to20"/>
42 </xsl:copy>
43 </xsl:template>
44
45 <!-- split section update -->
46 <para xmlns="http://docbook.org/ns/docbook">
47 Copy all attributes, when contents is NOT 'split'.
48 If contents contains 'split' and attribute <tag class="attribute">
49 filesystem</tag> contains a comma, then split this attribute and
50 create two new attributes <tag class="attribute">fsreadwrite</tag>
51 and <tag class="attribute">fsreadonly</tag>.
52 </para>
53 <xsl:template match="type" mode="conv14to20" >
54 <xsl:variable name="fs" select="normalize-space(@filesystem)"/>
55 <xsl:variable name="contents" select="."/>
56 <type>
57 <xsl:choose>
58 <xsl:when test="$contents != 'split'">
59 <xsl:copy-of select="@*"/>
60 <xsl:apply-templates mode="conv14to20"/>
61 </xsl:when>
62 <xsl:when test="$contents = 'split' and contains($fs, ',')">
63 <xsl:attribute name="fsreadwrite">
64 <xsl:value-of select="substring-before($fs, ',')"/>
65 </xsl:attribute>
66 <xsl:attribute name="fsreadonly">
67 <xsl:value-of select="substring-after($fs, ',')"/>
68 </xsl:attribute>
69 <xsl:copy-of select="@boot"/>
70 <xsl:copy-of select="@format"/>
71 <xsl:apply-templates mode="conv14to20"/>
72 </xsl:when>
73 <xsl:otherwise>
74 <xsl:copy-of select="@*"/>
75 <xsl:apply-templates mode="conv14to20"/>
76 </xsl:otherwise>
77 </xsl:choose>
78 </type>
79 </xsl:template>
80
81 <!-- update boot / bootstrap -->
82 <para xmlns="http://docbook.org/ns/docbook">
83 Change attribute value <tag class="attribute">boot</tag> to
84 <tag class="attribute">bootstrap</tag>.
85 </para>
86 <xsl:template match="packages[@type='boot']" mode="conv14to20">
87 <packages type="bootstrap">
88 <xsl:apply-templates mode="conv14to20"/>
89 </packages>
90 </xsl:template>
91
92 </xsl:stylesheet>