VirtualBox

source: vbox/trunk/src/VBox/Main/xml/SettingsConverter.xsl@ 14437

Last change on this file since 14437 was 14437, checked in by vboxsync, 16 years ago

FE/Qt4: 2883: Structure OS list. Feature request implemented in base designed variant.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.7 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 * :tabSize=2:indentSize=2:noTabs=true:
5 * :folding=explicit:collapseFolds=1:
6 *
7 * Template to convert old VirtualBox settings files to the most recent format.
8
9 Copyright (C) 2006-2008 Sun Microsystems, Inc.
10
11 This file is part of VirtualBox Open Source Edition (OSE), as
12 available from http://www.virtualbox.org. This file is free software;
13 you can redistribute it and/or modify it under the terms of the GNU
14 General Public License (GPL) as published by the Free Software
15 Foundation, in version 2 as it comes in the "COPYING" file of the
16 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18
19 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
20 Clara, CA 95054 USA or visit http://www.sun.com if you need
21 additional information or have any questions.
22-->
23
24<xsl:stylesheet version="1.0"
25 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
26 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
27 xmlns:vb="http://www.innotek.de/VirtualBox-settings"
28 xmlns="http://www.innotek.de/VirtualBox-settings"
29 exclude-result-prefixes="#default vb xsl xsd"
30>
31
32<xsl:output method="xml" indent="yes"/>
33
34<xsl:variable name="curVer" select="substring-before(/vb:VirtualBox/@version, '-')"/>
35<xsl:variable name="curVerPlat" select="substring-after(/vb:VirtualBox/@version, '-')"/>
36<xsl:variable name="curVerFull" select="/vb:VirtualBox/@version"/>
37
38<xsl:template match="/">
39 <xsl:comment> Automatically converted from version '<xsl:value-of select="$curVerFull"/>' </xsl:comment>
40 <xsl:copy>
41 <xsl:apply-templates select="@*|node()"/>
42 </xsl:copy>
43</xsl:template>
44
45<!--
46 * comments outside the root node are gathered to a single line, fix this
47-->
48<xsl:template match="/comment()">
49 <xsl:copy-of select="."/>
50</xsl:template>
51
52<!--
53 * Forbid non-VirtualBox root nodes
54-->
55<xsl:template match="/*">
56 <xsl:message terminate="yes">
57Cannot convert an unknown XML file with the root node '<xsl:value-of select="name()"/>'!
58 </xsl:message>
59</xsl:template>
60
61<!--
62 * Forbid all unsupported VirtualBox settings versions
63-->
64<xsl:template match="/vb:VirtualBox">
65 <xsl:message terminate="yes">
66Cannot convert settings from version '<xsl:value-of select="@version"/>'.
67The source version is not supported.
68 </xsl:message>
69</xsl:template>
70
71<!--
72 * Accept supported settings versions (source setting files we can convert)
73 *
74 * Note that in order to simplify conversion from versions prior to the previous
75 * one, we support multi-step conversion like this: step 1: 1.0 => 1.1,
76 * step 2: 1.1 => 1.2, where 1.2 is the most recent version. If you want to use
77 * such multi-step mode, you need to ensure that only 1.0 => 1.1 is possible, by
78 * using the 'mode=1.1' attribute on both 'apply-templates' within the starting
79 * '/vb:VirtualBox[1.0]' template and within all templates that this
80 * 'apply-templates' should apply.
81 *
82 * If no 'mode' attribute is used as described above, then a direct conversion
83 * (1.0 => 1.2 in the above example) will happen when version 1.0 of the settings
84 * files is detected. Note that the direct conversion from pre-previous versions
85 * will require to patch their conversion templates so that they include all
86 * modifications from all newer versions, which is error-prone. It's better to
87 * use the milt-step mode.
88-->
89
90<!-- 1.1 => 1.2 -->
91<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.1']">
92 <xsl:copy>
93 <xsl:attribute name="version"><xsl:value-of select="concat('1.2','-',$curVerPlat)"/></xsl:attribute>
94 <xsl:apply-templates select="node()" mode="v1.2"/>
95 </xsl:copy>
96</xsl:template>
97
98<!-- 1.2 => 1.3.pre -->
99<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.2']">
100 <xsl:copy>
101 <xsl:attribute name="version"><xsl:value-of select="concat('1.3.pre','-',$curVerPlat)"/></xsl:attribute>
102 <xsl:apply-templates select="node()" mode="v1.3.pre"/>
103 </xsl:copy>
104</xsl:template>
105
106<!-- 1.3.pre => 1.3 -->
107<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.3.pre']">
108 <xsl:copy>
109 <xsl:attribute name="version"><xsl:value-of select="concat('1.3','-',$curVerPlat)"/></xsl:attribute>
110 <xsl:apply-templates select="node()" mode="v1.3"/>
111 </xsl:copy>
112</xsl:template>
113
114<!-- 1.3 => 1.4 -->
115<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.3']">
116 <xsl:copy>
117 <xsl:attribute name="version"><xsl:value-of select="concat('1.4','-',$curVerPlat)"/></xsl:attribute>
118 <xsl:apply-templates select="node()" mode="v1.4"/>
119 </xsl:copy>
120</xsl:template>
121
122<!-- 1.4 => 1.5 -->
123<xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.4']">
124 <xsl:copy>
125 <xsl:attribute name="version"><xsl:value-of select="concat('1.5','-',$curVerPlat)"/></xsl:attribute>
126 <xsl:apply-templates select="node()" mode="v1.5"/>
127 </xsl:copy>
128</xsl:template>
129
130<!--
131 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
132 * 1.1 => 1.2
133 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
134-->
135
136<!--
137 * all non-root elements that are not explicitly matched are copied as is
138-->
139<xsl:template match="@*|node()[../..]" mode="v1.2">
140 <xsl:copy>
141 <xsl:apply-templates select="@*|node()[../..]" mode="v1.2"/>
142 </xsl:copy>
143</xsl:template>
144
145<!--
146 * Global settings
147-->
148
149<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
150 vb:Global/vb:DiskImageRegistry/vb:HardDiskImages//
151 vb:Image"
152 mode="v1.2">
153 <DiffHardDisk>
154 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
155 <VirtualDiskImage>
156 <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
157 </VirtualDiskImage>
158 <xsl:apply-templates select="vb:Image"/>
159 </DiffHardDisk>
160</xsl:template>
161
162<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
163 vb:Global/vb:DiskImageRegistry"
164 mode="v1.2">
165<DiskRegistry>
166 <HardDisks>
167 <xsl:for-each select="vb:HardDiskImages/vb:Image">
168 <HardDisk>
169 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
170 <xsl:attribute name="type">
171 <xsl:choose>
172 <xsl:when test="@independent='immutable'">immutable</xsl:when>
173 <xsl:when test="@independent='mutable'">immutable</xsl:when>
174 <xsl:otherwise>normal</xsl:otherwise>
175 </xsl:choose>
176 </xsl:attribute>
177 <VirtualDiskImage>
178 <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
179 </VirtualDiskImage>
180 <xsl:apply-templates select="vb:Image"/>
181 </HardDisk>
182 </xsl:for-each>
183 </HardDisks>
184 <xsl:copy-of select="vb:DVDImages"/>
185 <xsl:copy-of select="vb:FloppyImages"/>
186</DiskRegistry>
187</xsl:template>
188
189<!--
190 * Machine settings
191-->
192
193<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
194 vb:Machine//vb:HardDisks"
195 mode="v1.2">
196 <HardDiskAttachments>
197 <xsl:for-each select="vb:HardDisk">
198 <HardDiskAttachment>
199 <xsl:attribute name="hardDisk"><xsl:value-of select="vb:Image/@uuid"/></xsl:attribute>
200 <xsl:apply-templates select="@*"/>
201 </HardDiskAttachment>
202 </xsl:for-each>
203 </HardDiskAttachments>
204</xsl:template>
205
206<!--
207 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
208 * 1.2 => 1.3.pre
209 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
210-->
211
212<!--
213 * all non-root elements that are not explicitly matched are copied as is
214-->
215<xsl:template match="@*|node()[../..]" mode="v1.3.pre">
216 <xsl:copy>
217 <xsl:apply-templates select="@*|node()[../..]" mode="v1.3.pre"/>
218 </xsl:copy>
219</xsl:template>
220
221<!--
222 * Global settings
223-->
224
225<!--
226 * Machine settings
227-->
228
229<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
230 vb:Machine//vb:USBController"
231 mode="v1.3.pre">
232 <xsl:copy>
233 <xsl:apply-templates select="@*|node()" mode="v1.3.pre"/>
234 </xsl:copy>
235 <SATAController enabled="false"/>
236</xsl:template>
237
238<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
239 vb:Machine//vb:HardDiskAttachments/vb:HardDiskAttachment"
240 mode="v1.3.pre">
241 <HardDiskAttachment>
242 <xsl:attribute name="hardDisk"><xsl:value-of select="@hardDisk"/></xsl:attribute>
243 <xsl:attribute name="bus">
244 <xsl:choose>
245 <xsl:when test="@bus='ide0'">
246 <xsl:text>IDE</xsl:text>
247 </xsl:when>
248 <xsl:when test="@bus='ide1'">
249 <xsl:text>IDE</xsl:text>
250 </xsl:when>
251 <xsl:otherwise>
252 <xsl:message terminate="yes">
253Value '<xsl:value-of select="@bus"/>' of 'HardDiskAttachment::bus' attribute is invalid.
254 </xsl:message>
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:attribute>
258 <xsl:attribute name="channel">0</xsl:attribute>
259 <xsl:attribute name="device">
260 <xsl:choose>
261 <xsl:when test="@device='master'">
262 <xsl:text>0</xsl:text>
263 </xsl:when>
264 <xsl:when test="@device='slave'">
265 <xsl:text>1</xsl:text>
266 </xsl:when>
267 <xsl:otherwise>
268 <xsl:message terminate="yes">
269Value '<xsl:value-of select="@device"/>' of 'HardDiskAttachment::device' attribute is invalid.
270 </xsl:message>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:attribute>
274 </HardDiskAttachment>
275</xsl:template>
276
277<!--
278 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
279 * 1.3.pre => 1.3
280 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
281-->
282
283<!--
284 * all non-root elements that are not explicitly matched are copied as is
285-->
286<xsl:template match="@*|node()[../..]" mode="v1.3">
287 <xsl:copy>
288 <xsl:apply-templates select="@*|node()[../..]" mode="v1.3"/>
289 </xsl:copy>
290</xsl:template>
291
292<!--
293 * Global settings
294-->
295
296<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
297 vb:Global//vb:SystemProperties"
298 mode="v1.3">
299 <xsl:copy>
300 <xsl:apply-templates select="@*[not(name()='defaultSavedStateFolder')]|node()" mode="v1.3"/>
301 </xsl:copy>
302</xsl:template>
303
304<!--
305 * Machine settings
306-->
307
308<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
309 vb:Machine//vb:AudioAdapter"
310 mode="v1.3">
311 <xsl:if test="not(../vb:Uart)">
312 <UART/>
313 </xsl:if>
314 <xsl:if test="not(../vb:Lpt)">
315 <LPT/>
316 </xsl:if>
317 <xsl:copy>
318 <xsl:apply-templates select="@*[not(name()='driver')]|node()" mode="v1.3"/>
319 <xsl:attribute name="driver">
320 <xsl:choose>
321 <xsl:when test="@driver='null'">Null</xsl:when>
322 <xsl:when test="@driver='oss'">OSS</xsl:when>
323 <xsl:when test="@driver='alsa'">ALSA</xsl:when>
324 <xsl:when test="@driver='pulse'">Pulse</xsl:when>
325 <xsl:when test="@driver='coreaudio'">CoreAudio</xsl:when>
326 <xsl:when test="@driver='winmm'">WinMM</xsl:when>
327 <xsl:when test="@driver='dsound'">DirectSound</xsl:when>
328 <xsl:when test="@driver='solaudio'">SolAudio</xsl:when>
329 <xsl:when test="@driver='mmpm'">MMPM</xsl:when>
330 <xsl:otherwise>
331 <xsl:message terminate="yes">
332Value '<xsl:value-of select="@driver"/>' of 'AudioAdapter::driver' attribute is invalid.
333 </xsl:message>
334 </xsl:otherwise>
335 </xsl:choose>
336 </xsl:attribute>
337 </xsl:copy>
338 <xsl:if test="not(../vb:SharedFolders)">
339 <SharedFolders/>
340 </xsl:if>
341 <xsl:if test="not(../vb:Clipboard)">
342 <Clipboard mode="Disabled"/>
343 </xsl:if>
344 <xsl:if test="not(../vb:Guest)">
345 <Guest/>
346 </xsl:if>
347</xsl:template>
348
349<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
350 vb:Machine//vb:RemoteDisplay"
351 mode="v1.3">
352 <xsl:copy>
353 <xsl:apply-templates select="@*[not(name()='authType')]|node()" mode="v1.3"/>
354 <xsl:attribute name="authType">
355 <xsl:choose>
356 <xsl:when test="@authType='null'">Null</xsl:when>
357 <xsl:when test="@authType='guest'">Guest</xsl:when>
358 <xsl:when test="@authType='external'">External</xsl:when>
359 <xsl:otherwise>
360 <xsl:message terminate="yes">
361Value '<xsl:value-of select="@authType"/>' of 'RemoteDisplay::authType' attribute is invalid.
362 </xsl:message>
363 </xsl:otherwise>
364 </xsl:choose>
365 </xsl:attribute>
366 </xsl:copy>
367</xsl:template>
368
369<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
370 vb:Machine//vb:BIOS/vb:BootMenu"
371 mode="v1.3">
372 <xsl:copy>
373 <xsl:apply-templates select="@*[not(name()='mode')]|node()" mode="v1.3"/>
374 <xsl:attribute name="mode">
375 <xsl:choose>
376 <xsl:when test="@mode='disabled'">Disabled</xsl:when>
377 <xsl:when test="@mode='menuonly'">MenuOnly</xsl:when>
378 <xsl:when test="@mode='messageandmenu'">MessageAndMenu</xsl:when>
379 <xsl:otherwise>
380 <xsl:message terminate="yes">
381Value '<xsl:value-of select="@mode"/>' of 'BootMenu::mode' attribute is invalid.
382 </xsl:message>
383 </xsl:otherwise>
384 </xsl:choose>
385 </xsl:attribute>
386 </xsl:copy>
387</xsl:template>
388
389<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
390 vb:Machine//vb:USBController/vb:DeviceFilter |
391 vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
392 vb:Global/vb:USBDeviceFilters/vb:DeviceFilter"
393 mode="v1.3">
394 <xsl:copy>
395 <xsl:apply-templates select="node()" mode="v1.3"/>
396 <xsl:for-each select="@*">
397 <xsl:choose>
398 <xsl:when test="name()='vendorid'">
399 <xsl:attribute name="vendorId"><xsl:value-of select="."/></xsl:attribute>
400 </xsl:when>
401 <xsl:when test="name()='productid'">
402 <xsl:attribute name="productId"><xsl:value-of select="."/></xsl:attribute>
403 </xsl:when>
404 <xsl:when test="name()='serialnumber'">
405 <xsl:attribute name="serialNumber"><xsl:value-of select="."/></xsl:attribute>
406 </xsl:when>
407 <xsl:otherwise>
408 <xsl:apply-templates select="." mode="v1.3"/>
409 </xsl:otherwise>
410 </xsl:choose>
411 </xsl:for-each>
412 </xsl:copy>
413</xsl:template>
414
415<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
416 vb:Machine//vb:Guest"
417 mode="v1.3">
418 <xsl:copy>
419 <xsl:apply-templates select="node()" mode="v1.3"/>
420 <xsl:for-each select="@*">
421 <xsl:choose>
422 <xsl:when test="name()='MemoryBalloonSize'">
423 <xsl:attribute name="memoryBalloonSize"><xsl:value-of select="."/></xsl:attribute>
424 </xsl:when>
425 <xsl:when test="name()='StatisticsUpdateInterval'">
426 <xsl:attribute name="statisticsUpdateInterval"><xsl:value-of select="."/></xsl:attribute>
427 </xsl:when>
428 <xsl:otherwise>
429 <xsl:apply-templates select="node()" mode="v1.3"/>
430 </xsl:otherwise>
431 </xsl:choose>
432 </xsl:for-each>
433 </xsl:copy>
434</xsl:template>
435
436<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
437 vb:Machine//vb:Uart"
438 mode="v1.3">
439 <UART>
440 <xsl:apply-templates select="@*|node()" mode="v1.3"/>
441 </UART>
442</xsl:template>
443
444<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
445 vb:Machine//vb:Lpt"
446 mode="v1.3">
447 <LPT>
448 <xsl:apply-templates select="@*|node()" mode="v1.3"/>
449 </LPT>
450</xsl:template>
451
452<!--
453 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
454 * 1.3 => 1.4
455 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
456-->
457
458<!--
459 * all non-root elements that are not explicitly matched are copied as is
460-->
461<xsl:template match="@*|node()[../..]" mode="v1.4">
462 <xsl:copy>
463 <xsl:apply-templates select="@*|node()[../..]" mode="v1.4"/>
464 </xsl:copy>
465</xsl:template>
466
467<!--
468 * Global settings
469-->
470
471<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
472 vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk |
473 vb:VirtualBox[substring-before(@version,'-')='1.3']/
474 vb:Global/vb:DiskRegistry/vb:HardDisks//vb:DiffHardDisk"
475 mode="v1.4-HardDisk-format-location">
476 <xsl:attribute name="format">
477 <xsl:choose>
478 <xsl:when test="*[self::vb:VirtualDiskImage][1]">VDI</xsl:when>
479 <xsl:when test="*[self::vb:VMDKImage][1]">VMDK</xsl:when>
480 <xsl:when test="*[self::vb:VHDImage][1]">VHD</xsl:when>
481 <xsl:when test="*[self::vb:CustomHardDisk][1]">
482 <xsl:value-of select="@format"/>
483 </xsl:when>
484 <xsl:when test="*[self::vb:ISCSIHardDisk][1]">
485 <xsl:message terminate="yes">
486ISCSIHardDisk node requires manual conversion. Contact the product vendor.
487 </xsl:message>
488 </xsl:when>
489 <xsl:otherwise>
490 <xsl:message terminate="yes">
491Sub-element '<xsl:value-of select="name(*[1])"/>' of 'HardDisk' element is invalid.
492 </xsl:message>
493 </xsl:otherwise>
494 </xsl:choose>
495 </xsl:attribute>
496 <xsl:attribute name="location">
497 <xsl:choose>
498 <xsl:when test="*[self::vb:VirtualDiskImage][1]">
499 <xsl:value-of select="vb:VirtualDiskImage/@filePath"/>
500 </xsl:when>
501 <xsl:when test="*[self::vb:VMDKImage][1]">
502 <xsl:value-of select="vb:VMDKImage/@filePath"/>
503 </xsl:when>
504 <xsl:when test="*[self::vb:VHDImage][1]">
505 <xsl:value-of select="vb:VHDImage/@filePath"/>
506 </xsl:when>
507 <xsl:when test="*[self::vb:CustomHardDisk][1]">
508 <xsl:value-of select="vb:CustomHardDisk/@location"/>
509 </xsl:when>
510 <!--xsl:when test="*[self::vb:ISCSIHardDisk][1]">
511 <xsl:value-of select="concat('iscsi://',vb:ISCSIHardDisk/@userName,':',vb:ISCSIHardDisk/@password,'@',vb:ISCSIHardDisk/@server,':',vb:ISCSIHardDisk/@port,'/',vb:ISCSIHardDisk/@target,'/',vb:ISCSIHardDisk/@lun)"/>
512 </xsl:when-->
513 </xsl:choose>
514 </xsl:attribute>
515</xsl:template>
516
517<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
518 vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk"
519 mode="v1.4">
520 <HardDisk>
521 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
522 <xsl:apply-templates select="." mode="v1.4-HardDisk-format-location"/>
523 <xsl:attribute name="type">
524 <xsl:choose>
525 <xsl:when test="@type='normal'">Normal</xsl:when>
526 <xsl:when test="@type='immutable'">Immutable</xsl:when>
527 <xsl:when test="@type='writethrough'">Writethrough</xsl:when>
528 <xsl:otherwise>
529 <xsl:message terminate="yes">
530Value '<xsl:value-of select="@type"/>' of 'HardDisk::type' attribute is invalid.
531 </xsl:message>
532 </xsl:otherwise>
533 </xsl:choose>
534 </xsl:attribute>
535 <xsl:apply-templates select="vb:DiffHardDisk" mode="v1.4"/>
536 </HardDisk>
537</xsl:template>
538
539<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
540 vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk//
541 vb:DiffHardDisk"
542 mode="v1.4">
543 <HardDisk>
544 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
545 <xsl:apply-templates select="." mode="v1.4-HardDisk-format-location"/>
546 <xsl:apply-templates select="vb:DiffHardDisk" mode="v1.4"/>
547 </HardDisk>
548</xsl:template>
549
550<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
551 vb:Global/vb:DiskRegistry/vb:DVDImages/vb:Image |
552 vb:VirtualBox[substring-before(@version,'-')='1.3']/
553 vb:Global/vb:DiskRegistry/vb:FloppyImages/vb:Image"
554 mode="v1.4">
555 <Image>
556 <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
557 <xsl:attribute name="location"><xsl:value-of select="@src"/></xsl:attribute>
558 </Image>
559</xsl:template>
560
561<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
562 vb:Global/vb:DiskRegistry"
563 mode="v1.4">
564 <MediaRegistry>
565 <HardDisks>
566 <xsl:apply-templates select="vb:HardDisks/vb:HardDisk" mode="v1.4"/>
567 </HardDisks>
568 <DVDImages>
569 <xsl:apply-templates select="vb:DVDImages/vb:Image" mode="v1.4"/>
570 </DVDImages>
571 <FloppyImages>
572 <xsl:apply-templates select="vb:FloppyImages/vb:Image" mode="v1.4"/>
573 </FloppyImages>
574 </MediaRegistry>
575</xsl:template>
576
577<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
578 vb:Global/vb:SystemProperties"
579 mode="v1.4">
580 <SystemProperties>
581 <xsl:apply-templates select="@*[not(name()='defaultVDIFolder')]|node()" mode="v1.4"/>
582 <!-- use the @defaultVDIFolder value for @defaultHardDiskFolder only when it
583 differs from the default (VDI) and otherwise simply delete it to let
584 VBoxSVC set the correct new default value -->
585 <xsl:if test="not(translate(@defaultVDIFolder,'vdi','VDI')='VDI')">
586 <xsl:attribute name="defaultHardDiskFolder">
587 <xsl:value-of select="@defaultVDIFolder"/>
588 </xsl:attribute>
589 </xsl:if>
590 </SystemProperties>
591</xsl:template>
592
593<!--
594 * Machine settings
595-->
596
597<!--
598 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
599 * 1.4 => 1.5
600 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
601-->
602
603<!--
604 * all non-root elements that are not explicitly matched are copied as is
605-->
606<xsl:template match="@*|node()[../..]" mode="v1.5">
607 <xsl:copy>
608 <xsl:apply-templates select="@*|node()[../..]" mode="v1.5"/>
609 </xsl:copy>
610</xsl:template>
611
612<!--
613 * Global settings
614-->
615
616<!--
617 * Machine settings
618-->
619
620<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
621 vb:Machine"
622 mode="v1.5">
623 <xsl:copy>
624 <xsl:attribute name="OSType">
625 <xsl:choose>
626 <xsl:when test="@OSType='unknown'">Other</xsl:when>
627 <xsl:when test="@OSType='dos'">DOS</xsl:when>
628 <xsl:when test="@OSType='win31'">Windows31</xsl:when>
629 <xsl:when test="@OSType='win95'">Windows95</xsl:when>
630 <xsl:when test="@OSType='win98'">Windows98</xsl:when>
631 <xsl:when test="@OSType='winme'">WindowsMe</xsl:when>
632 <xsl:when test="@OSType='winnt4'">WindowsNT4</xsl:when>
633 <xsl:when test="@OSType='win2k'">Windows2000</xsl:when>
634 <xsl:when test="@OSType='winxp'">WindowsXP</xsl:when>
635 <xsl:when test="@OSType='win2k3'">Windows2003</xsl:when>
636 <xsl:when test="@OSType='winvista'">WindowsVista</xsl:when>
637 <xsl:when test="@OSType='win2k8'">Windows2008</xsl:when>
638 <xsl:when test="@OSType='os2warp3'">OS2Warp3</xsl:when>
639 <xsl:when test="@OSType='os2warp4'">OS2Warp4</xsl:when>
640 <xsl:when test="@OSType='os2warp45'">OS2Warp45</xsl:when>
641 <xsl:when test="@OSType='ecs'">OS2eCS</xsl:when>
642 <xsl:when test="@OSType='linux22'">Linux22</xsl:when>
643 <xsl:when test="@OSType='linux24'">Linux24</xsl:when>
644 <xsl:when test="@OSType='linux26'">Linux26</xsl:when>
645 <xsl:when test="@OSType='archlinux'">ArchLinux</xsl:when>
646 <xsl:when test="@OSType='debian'">Debian</xsl:when>
647 <xsl:when test="@OSType='opensuse'">OpenSUSE</xsl:when>
648 <xsl:when test="@OSType='fedoracore'">Fedora</xsl:when>
649 <xsl:when test="@OSType='gentoo'">Gentoo</xsl:when>
650 <xsl:when test="@OSType='mandriva'">Mandriva</xsl:when>
651 <xsl:when test="@OSType='redhat'">RedHat</xsl:when>
652 <xsl:when test="@OSType='ubuntu'">Ubuntu</xsl:when>
653 <xsl:when test="@OSType='xandros'">Xandros</xsl:when>
654 <xsl:when test="@OSType='freebsd'">FreeBSD</xsl:when>
655 <xsl:when test="@OSType='openbsd'">OpenBSD</xsl:when>
656 <xsl:when test="@OSType='netbsd'">NetBSD</xsl:when>
657 <xsl:when test="@OSType='netware'">Netware</xsl:when>
658 <xsl:when test="@OSType='solaris'">Solaris</xsl:when>
659 <xsl:when test="@OSType='opensolaris'">OpenSolaris</xsl:when>
660 <xsl:when test="@OSType='l4'">L4</xsl:when>
661 </xsl:choose>
662 </xsl:attribute>
663 <xsl:apply-templates select="@*[name()!='OSType']" mode="v1.5"/>
664 <xsl:apply-templates select="node()" mode="v1.5"/>
665 </xsl:copy>
666</xsl:template>
667
668<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
669 vb:Machine//vb:Hardware/vb:Display"
670 mode="v1.5">
671 <xsl:copy>
672 <xsl:apply-templates select="node()" mode="v1.5"/>
673 <xsl:for-each select="@*">
674 <xsl:choose>
675 <xsl:when test="name()='MonitorCount'">
676 <xsl:attribute name="monitorCount"><xsl:value-of select="."/></xsl:attribute>
677 </xsl:when>
678 <xsl:when test="name()='Accelerate3D'">
679 <xsl:attribute name="accelerate3D"><xsl:value-of select="."/></xsl:attribute>
680 </xsl:when>
681 <xsl:otherwise>
682 <xsl:apply-templates select="." mode="v1.5"/>
683 </xsl:otherwise>
684 </xsl:choose>
685 </xsl:for-each>
686 </xsl:copy>
687</xsl:template>
688
689<!--
690-->
691
692<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
693 vb:Machine//vb:Hardware/vb:CPU"
694 mode="v1.5">
695 <xsl:copy>
696 <xsl:attribute name="count"><xsl:value-of select="vb:CPUCount/@count"/></xsl:attribute>
697 <xsl:apply-templates select="@*" mode="v1.5"/>
698 <xsl:apply-templates select="node()[not(self::vb:CPUCount)]" mode="v1.5"/>
699 </xsl:copy>
700</xsl:template>
701
702
703<!-- @todo add lastStateChange with the current timestamp if missing.
704 * current-dateTime() is available only in XPath 2.0 so we will need to pass
705 * the current time as a parameter to the XSLT processor. -->
706<!--
707<xsl:template match="vb:VirtualBox[substring-before(@version,'-')='Xo.Yo']/
708 vb:Machine"
709 mode="X.Y">
710 <xsl:copy>
711 <xsl:if test="not(@lastStateChange)">
712 <xsl:attribute name="lastStateChange">
713 <xsl:value-of select="current-dateTime()"/>
714 </xsl:attribute>
715 </xsl:if>
716 <xsl:apply-templates select="@*|node()" mode="vX.Y"/>
717 </xsl:copy>
718</xsl:template>
719-->
720
721</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

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