Changeset 7441 in vbox for trunk/src/VBox/Main/xml
- Timestamp:
- Mar 13, 2008 1:39:30 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/xml/SettingsConverter.xsl
r7387 r7441 28 28 <xsl:output method = "xml" indent = "yes"/> 29 29 30 <xsl:variable name="recentVer" select="1.2"/>31 32 30 <xsl:variable name="curVer" select="substring-before(/vb:VirtualBox/@version, '-')"/> 33 31 <xsl:variable name="curVerPlat" select="substring-after(/vb:VirtualBox/@version, '-')"/> … … 35 33 36 34 <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> 38 36 <xsl:copy> 39 37 <xsl:apply-templates select="@*|node()"/> … … 61 59 --> 62 60 <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>69 61 <xsl:message terminate="yes"> 70 Cannot convert settings from version '<xsl:value-of select="@version"/>' to version '<xsl:value-of select="concat($recentVer,'-',$curVerPlat)"/>'.62 Cannot convert settings from version '<xsl:value-of select="@version"/>'. 71 63 The source version is not supported. 72 64 </xsl:message> … … 92 84 --> 93 85 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 --> 121 107 122 108 <!-- 123 109 * all non-root elements that are not explicitly matched are copied as is 124 110 --> 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> 162 116 163 117 <!-- … … 165 119 --> 166 120 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"> 170 125 <DiffHardDisk> 171 126 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute> … … 173 128 <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute> 174 129 </VirtualDiskImage> 175 <xsl:apply-templates select=" Image"/>130 <xsl:apply-templates select="vb:Image"/> 176 131 </DiffHardDisk> 177 132 </xsl:template> 178 133 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"> 181 137 <DiskRegistry> 182 138 <HardDisks> 183 <xsl:for-each select=" HardDiskImages/Image">139 <xsl:for-each select="vb:HardDiskImages/vb:Image"> 184 140 <HardDisk> 185 141 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute> … … 194 150 <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute> 195 151 </VirtualDiskImage> 196 <xsl:apply-templates select=" Image"/>152 <xsl:apply-templates select="vb:Image"/> 197 153 </HardDisk> 198 154 </xsl:for-each> 199 155 </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"/> 202 158 </DiskRegistry> 203 159 </xsl:template> … … 207 163 --> 208 164 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"> 211 168 <HardDiskAttachments> 212 <xsl:for-each select=" HardDisk">169 <xsl:for-each select="vb:HardDisk"> 213 170 <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> 215 172 <xsl:apply-templates select="@*"/> 216 173 </HardDiskAttachment> … … 221 178 <!-- 222 179 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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"> 225 Value '<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"> 241 Value '<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> 226 248 227 249 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.