VirtualBox

Changeset 7441 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Mar 13, 2008 1:39:30 PM (17 years ago)
Author:
vboxsync
Message:

Main/Settings: Added version 1.2=>1.3.pre conversion templates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/SettingsConverter.xsl

    r7387 r7441  
    2828<xsl:output method = "xml" indent = "yes"/>
    2929
    30 <xsl:variable name="recentVer" select="1.2"/>
    31 
    3230<xsl:variable name="curVer" select="substring-before(/vb:VirtualBox/@version, '-')"/>
    3331<xsl:variable name="curVerPlat" select="substring-after(/vb:VirtualBox/@version, '-')"/>
     
    3533
    3634<xsl:template match="/">
    37   <xsl:comment> Automatically converted from version '<xsl:value-of select="$curVerFull"/>' to version '<xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/>' </xsl:comment>
     35  <xsl:comment> Automatically converted from version '<xsl:value-of select="$curVerFull"/>' </xsl:comment>
    3836  <xsl:copy>
    3937    <xsl:apply-templates select="@*|node()"/>
     
    6159-->
    6260<xsl:template match="/vb:VirtualBox">
    63   <xsl:if test="@version=concat($recentVer,'-',$curVerPlat)">
    64     <xsl:message terminate="yes">
    65 Cannot convert settings from version '<xsl:value-of select="@version"/>' to version '<xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/>'.
    66 The source is already at the most recent version.
    67     </xsl:message>
    68   </xsl:if>
    6961  <xsl:message terminate="yes">
    70 Cannot convert settings from version '<xsl:value-of select="@version"/>' to version '<xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/>'.
     62Cannot convert settings from version '<xsl:value-of select="@version"/>'.
    7163The source version is not supported.
    7264  </xsl:message>
     
    9284-->
    9385
    94 <!-- @todo temporary -->
    95 <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='0.1']">
    96   <xsl:copy>
    97     <xsl:attribute name="version"><xsl:value-of select="concat('0.2','-',$curVerPlat)"/></xsl:attribute>
    98     <xsl:apply-templates select="node()" mode="v0.2"/>
    99   </xsl:copy>
    100 </xsl:template>
    101 <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='0.2']">
    102   <xsl:copy>
    103     <xsl:attribute name="version"><xsl:value-of select="concat('0.3','-',$curVerPlat)"/></xsl:attribute>
    104     <xsl:apply-templates select="node()" mode="v0.3"/>
    105   </xsl:copy>
    106 </xsl:template>
    107 
    108 <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='0.1']/vb:Machine"
    109               mode="v0.2">
    110   <Machine>
    111     0.2
    112   </Machine>
    113 </xsl:template>
    114 
    115 <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='0.2']/vb:Machine"
    116               mode="v0.3">
    117   <Machine>
    118     0.3
    119   </Machine>
    120 </xsl:template>
     86<!-- 1.1 => 1.2 -->
     87<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.1']">
     88  <xsl:copy>
     89    <xsl:attribute name="version"><xsl:value-of select="concat('1.2','-',$curVerPlat)"/></xsl:attribute>
     90    <xsl:apply-templates select="node()" mode="v1.2"/>
     91  </xsl:copy>
     92</xsl:template>
     93
     94<!-- 1.2 => 1.3.pre -->
     95<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.2']">
     96  <xsl:copy>
     97    <xsl:attribute name="version"><xsl:value-of select="concat('1.3.pre','-',$curVerPlat)"/></xsl:attribute>
     98    <xsl:apply-templates select="node()" mode="v1.3.pre"/>
     99  </xsl:copy>
     100</xsl:template>
     101
     102<!--
     103 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     104 *  1.1 => 1.2
     105 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     106-->
    121107
    122108<!--
    123109 *  all non-root elements that are not explicitly matched are copied as is
    124110-->
    125 <xsl:template match="@*|node()[../..]" mode="v0.2">
    126   <xsl:copy>
    127     <xsl:apply-templates select="@*|node()[../..]" mode="v0.2"/>
    128   </xsl:copy>
    129 </xsl:template>
    130 
    131 <!--
    132  *  all non-root elements that are not explicitly matched are copied as is
    133 -->
    134 <xsl:template match="@*|node()[../..]" mode="v0.3">
    135   <xsl:copy>
    136     <xsl:apply-templates select="@*|node()[../..]" mode="v0.3"/>
    137   </xsl:copy>
    138 </xsl:template>
    139 
    140 <!-- @todo do 1.1 => 1.2 => current? -->
    141 <!--xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.1']">
    142   <xsl:copy>
    143     <xsl:attribute name="version"><xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/></xsl:attribute>
    144     <xsl:apply-templates select="node()"/>
    145   </xsl:copy>
    146 </xsl:template-->
    147 
    148   <!--
    149 <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.2"]">
    150   <xsl:copy>
    151     <xsl:attribute name="version"><xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/></xsl:attribute>
    152     <xsl:apply-templates select="node()"/>
    153   </xsl:copy>
    154 </xsl:template>
    155   -->
    156 
    157 <!--
    158  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    159  *  1.1 => 1.2 ???
    160  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    161 -->
     111<xsl:template match="@*|node()[../..]" mode="v1.2">
     112  <xsl:copy>
     113    <xsl:apply-templates select="@*|node()[../..]" mode="v1.2"/>
     114  </xsl:copy>
     115</xsl:template>
    162116
    163117<!--
     
    165119-->
    166120
    167 <xsl:template match="VirtualBox[substring-before(@version,'-')='1.1']/
    168                      Global/DiskImageRegistry/HardDiskImages//
    169                      Image">
     121<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
     122                     vb:Global/vb:DiskImageRegistry/vb:HardDiskImages//
     123                     vb:Image"
     124              mode="v1.2">
    170125  <DiffHardDisk>
    171126    <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
     
    173128      <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
    174129    </VirtualDiskImage>
    175     <xsl:apply-templates select="Image"/>
     130    <xsl:apply-templates select="vb:Image"/>
    176131  </DiffHardDisk>
    177132</xsl:template>
    178133
    179 <xsl:template match="VirtualBox[substring-before(@version,'-')='1.1']/
    180                      Global/DiskImageRegistry">
     134<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
     135                     vb:Global/vb:DiskImageRegistry"
     136              mode="v1.2">
    181137<DiskRegistry>
    182138  <HardDisks>
    183     <xsl:for-each select="HardDiskImages/Image">
     139    <xsl:for-each select="vb:HardDiskImages/vb:Image">
    184140      <HardDisk>
    185141        <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
     
    194150          <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
    195151        </VirtualDiskImage>
    196         <xsl:apply-templates select="Image"/>
     152        <xsl:apply-templates select="vb:Image"/>
    197153      </HardDisk>
    198154    </xsl:for-each>
    199155  </HardDisks>
    200   <xsl:copy-of select="DVDImages"/>
    201   <xsl:copy-of select="FloppyImages"/>
     156  <xsl:copy-of select="vb:DVDImages"/>
     157  <xsl:copy-of select="vb:FloppyImages"/>
    202158</DiskRegistry>
    203159</xsl:template>
     
    207163-->
    208164
    209 <xsl:template match="VirtualBox[substring-before(@version,'-')='1.1']/
    210                      Machine//HardDisks">
     165<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
     166                     vb:Machine//vb:HardDisks"
     167              mode="v1.2">
    211168  <HardDiskAttachments>
    212     <xsl:for-each select="HardDisk">
     169    <xsl:for-each select="vb:HardDisk">
    213170      <HardDiskAttachment>
    214         <xsl:attribute name="hardDisk"><xsl:value-of select="Image/@uuid"/></xsl:attribute>
     171        <xsl:attribute name="hardDisk"><xsl:value-of select="vb:Image/@uuid"/></xsl:attribute>
    215172        <xsl:apply-templates select="@*"/>
    216173      </HardDiskAttachment>
     
    221178<!--
    222179 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    223  *  1.2 => current
    224  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    225 -->
     180 *  1.2 => 1.3.pre
     181 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     182-->
     183
     184<!--
     185 *  all non-root elements that are not explicitly matched are copied as is
     186-->
     187<xsl:template match="@*|node()[../..]" mode="v1.3.pre">
     188  <xsl:copy>
     189    <xsl:apply-templates select="@*|node()[../..]" mode="v1.3.pre"/>
     190  </xsl:copy>
     191</xsl:template>
     192
     193<!--
     194 *  Global settings
     195-->
     196
     197<!--
     198 *  Machine settings
     199-->
     200
     201<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
     202                    vb:Machine//vb:USBController"
     203              mode="v1.3.pre">
     204  <xsl:copy>
     205    <xsl:apply-templates select="@*|node()" mode="v1.3.pre"/>
     206  </xsl:copy>
     207  <SATAController enabled="false"/>
     208</xsl:template>
     209
     210<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
     211                     vb:Machine//vb:HardDiskAttachments/vb:HardDiskAttachment"
     212              mode="v1.3.pre">
     213  <HardDiskAttachment>
     214    <xsl:attribute name="hardDisk"><xsl:value-of select="@hardDisk"/></xsl:attribute>
     215    <xsl:attribute name="bus">
     216      <xsl:choose>
     217        <xsl:when test="@bus='ide0'">
     218          <xsl:text>IDE</xsl:text>
     219        </xsl:when>
     220        <xsl:when test="@bus='ide1'">
     221          <xsl:text>IDE</xsl:text>
     222        </xsl:when>
     223        <xsl:otherwise>
     224          <xsl:message terminate="yes">
     225Value '<xsl:value-of select="@bus"/>' of 'HardDiskAttachment::bus' attribute is invalid.
     226          </xsl:message>
     227        </xsl:otherwise>
     228      </xsl:choose>
     229    </xsl:attribute>
     230    <xsl:attribute name="channel">0</xsl:attribute>
     231    <xsl:attribute name="device">
     232      <xsl:choose>
     233        <xsl:when test="@device='master'">
     234          <xsl:text>0</xsl:text>
     235        </xsl:when>
     236        <xsl:when test="@device='slave'">
     237          <xsl:text>1</xsl:text>
     238        </xsl:when>
     239        <xsl:otherwise>
     240          <xsl:message terminate="yes">
     241Value '<xsl:value-of select="@device"/>' of 'HardDiskAttachment::device' attribute is invalid.
     242          </xsl:message>
     243        </xsl:otherwise>
     244      </xsl:choose>
     245    </xsl:attribute>
     246  </HardDiskAttachment>
     247</xsl:template>
    226248
    227249</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette