| 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 |
|
| 7 |
<!-- default rule --> |
| 8 |
<xsl:template match="*" mode="conv41to42"> |
| 9 |
<xsl:copy> |
| 10 |
<xsl:copy-of select="@*"/> |
| 11 |
<xsl:apply-templates mode="conv41to42"/> |
| 12 |
</xsl:copy> |
| 13 |
</xsl:template> |
| 14 |
|
| 15 |
<!-- ec2 varaibles --> |
| 16 |
<xsl:variable name="ec2privatekey" select="/image/preferences/type/@ec2privatekeyfile"/> |
| 17 |
<xsl:variable name="ec2cert" select="/image/preferences/type/@ec2certfile"/> |
| 18 |
<xsl:variable name="ec2acct" select="/image/preferences/type/@ec2accountnr"/> |
| 19 |
|
| 20 |
<!-- version update --> |
| 21 |
<para xmlns="http://docbook.org/ns/docbook"> |
| 22 |
Changed attribute <tag class="attribute">schemaversion</tag> |
| 23 |
to <tag class="attribute">schemaversion</tag> from |
| 24 |
<literal>4.1</literal> to <literal>4.2</literal>. Created new |
| 25 |
<tag class="element">ec2config</tag> element to collect |
| 26 |
<tag class="attribute">ec2*</tag> attributes. The |
| 27 |
<tag class="element">ec2config</tag> element is a child of the |
| 28 |
<tag class="element">type</tag> element. |
| 29 |
</para> |
| 30 |
<xsl:template match="image" mode="conv41to42"> |
| 31 |
<xsl:choose> |
| 32 |
<!-- nothing to do if already at 4.2 --> |
| 33 |
<xsl:when test="@schemaversion > 4.1"> |
| 34 |
<xsl:copy-of select="."/> |
| 35 |
</xsl:when> |
| 36 |
<!-- otherwise apply templates --> |
| 37 |
<xsl:otherwise> |
| 38 |
<image schemaversion="4.2"> |
| 39 |
<xsl:copy-of select="@*[local-name() != 'schemaversion']"/> |
| 40 |
<xsl:apply-templates mode="conv41to42"/> |
| 41 |
</image> |
| 42 |
</xsl:otherwise> |
| 43 |
</xsl:choose> |
| 44 |
</xsl:template> |
| 45 |
|
| 46 |
<!-- toplevel processing instructions and comments --> |
| 47 |
<xsl:template match="processing-instruction()|comment()" mode="conv41to42"> |
| 48 |
<xsl:copy> |
| 49 |
<xsl:copy-of select="@*"/> |
| 50 |
<xsl:apply-templates mode="conv41to42"/> |
| 51 |
</xsl:copy> |
| 52 |
</xsl:template> |
| 53 |
|
| 54 |
<xsl:template match="preferences" mode="conv41to42"> |
| 55 |
<preferences> |
| 56 |
<xsl:copy-of select="@*"/> |
| 57 |
<xsl:apply-templates mode="conv41to42"/> |
| 58 |
</preferences> |
| 59 |
</xsl:template> |
| 60 |
|
| 61 |
<xsl:template match="type" mode="conv41to42"> |
| 62 |
<xsl:choose> |
| 63 |
<xsl:when test="@image='ec2'"> |
| 64 |
<type> |
| 65 |
<xsl:for-each select="@*"> |
| 66 |
<xsl:choose> |
| 67 |
<xsl:when test="name()='ec2privatekeyfile'"/> |
| 68 |
<xsl:when test="name()='ec2certfile'"/> |
| 69 |
<xsl:when test="name()='ec2accountnr'"/> |
| 70 |
<xsl:otherwise> |
| 71 |
<xsl:attribute name="{local-name()}"> |
| 72 |
<xsl:value-of select="."/> |
| 73 |
</xsl:attribute> |
| 74 |
</xsl:otherwise> |
| 75 |
</xsl:choose> |
| 76 |
</xsl:for-each> |
| 77 |
<xsl:if test="$ec2privatekey or $ec2cert or $ec2acct"> |
| 78 |
<ec2config> |
| 79 |
<xsl:if test="$ec2privatekey"> |
| 80 |
<ec2privatekeyfile> |
| 81 |
<xsl:value-of select="$ec2privatekey"/> |
| 82 |
</ec2privatekeyfile> |
| 83 |
</xsl:if> |
| 84 |
|
| 85 |
<xsl:if test="$ec2cert"> |
| 86 |
<ec2certfile> |
| 87 |
<xsl:value-of select="$ec2cert"/> |
| 88 |
</ec2certfile> |
| 89 |
</xsl:if> |
| 90 |
|
| 91 |
<xsl:if test="$ec2acct"> |
| 92 |
<ec2accountnr> |
| 93 |
<xsl:value-of select="$ec2acct"/> |
| 94 |
</ec2accountnr> |
| 95 |
</xsl:if> |
| 96 |
</ec2config> |
| 97 |
</xsl:if> |
| 98 |
<xsl:copy-of select="current()/*"/> |
| 99 |
</type> |
| 100 |
</xsl:when> |
| 101 |
<xsl:otherwise> |
| 102 |
<xsl:copy-of select="."/> |
| 103 |
</xsl:otherwise> |
| 104 |
</xsl:choose> |
| 105 |
</xsl:template> |
| 106 |
|
| 107 |
</xsl:stylesheet> |