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">
|
---|
57 | Cannot 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">
|
---|
66 | Cannot convert settings from version '<xsl:value-of select="@version"/>'.
|
---|
67 | The 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 | <!-- 1.5 => 1.6 -->
|
---|
131 | <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.5']">
|
---|
132 | <xsl:copy>
|
---|
133 | <xsl:attribute name="version"><xsl:value-of select="concat('1.6','-',$curVerPlat)"/></xsl:attribute>
|
---|
134 | <xsl:apply-templates select="node()" mode="v1.6"/>
|
---|
135 | </xsl:copy>
|
---|
136 | </xsl:template>
|
---|
137 |
|
---|
138 | <!-- 1.6 => 1.7 -->
|
---|
139 | <xsl:template match="/vb:VirtualBox[substring-before(@version,'-')='1.6']">
|
---|
140 | <xsl:copy>
|
---|
141 | <xsl:attribute name="version"><xsl:value-of select="concat('1.7','-',$curVerPlat)"/></xsl:attribute>
|
---|
142 | <xsl:apply-templates select="node()" mode="v1.7"/>
|
---|
143 | </xsl:copy>
|
---|
144 | </xsl:template>
|
---|
145 |
|
---|
146 | <!--
|
---|
147 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
148 | * 1.1 => 1.2
|
---|
149 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
150 | -->
|
---|
151 |
|
---|
152 | <!--
|
---|
153 | * all non-root elements that are not explicitly matched are copied as is
|
---|
154 | -->
|
---|
155 | <xsl:template match="@*|node()[../..]" mode="v1.2">
|
---|
156 | <xsl:copy>
|
---|
157 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.2"/>
|
---|
158 | </xsl:copy>
|
---|
159 | </xsl:template>
|
---|
160 |
|
---|
161 | <!--
|
---|
162 | * Global settings
|
---|
163 | -->
|
---|
164 |
|
---|
165 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
|
---|
166 | vb:Global/vb:DiskImageRegistry/vb:HardDiskImages//
|
---|
167 | vb:Image"
|
---|
168 | mode="v1.2">
|
---|
169 | <DiffHardDisk>
|
---|
170 | <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
|
---|
171 | <VirtualDiskImage>
|
---|
172 | <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
|
---|
173 | </VirtualDiskImage>
|
---|
174 | <xsl:apply-templates select="vb:Image"/>
|
---|
175 | </DiffHardDisk>
|
---|
176 | </xsl:template>
|
---|
177 |
|
---|
178 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
|
---|
179 | vb:Global/vb:DiskImageRegistry"
|
---|
180 | mode="v1.2">
|
---|
181 | <DiskRegistry>
|
---|
182 | <HardDisks>
|
---|
183 | <xsl:for-each select="vb:HardDiskImages/vb:Image">
|
---|
184 | <HardDisk>
|
---|
185 | <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
|
---|
186 | <xsl:attribute name="type">
|
---|
187 | <xsl:choose>
|
---|
188 | <xsl:when test="@independent='immutable'">immutable</xsl:when>
|
---|
189 | <xsl:when test="@independent='mutable'">immutable</xsl:when>
|
---|
190 | <xsl:otherwise>normal</xsl:otherwise>
|
---|
191 | </xsl:choose>
|
---|
192 | </xsl:attribute>
|
---|
193 | <VirtualDiskImage>
|
---|
194 | <xsl:attribute name="filePath"><xsl:value-of select="@src"/></xsl:attribute>
|
---|
195 | </VirtualDiskImage>
|
---|
196 | <xsl:apply-templates select="vb:Image"/>
|
---|
197 | </HardDisk>
|
---|
198 | </xsl:for-each>
|
---|
199 | </HardDisks>
|
---|
200 | <xsl:copy-of select="vb:DVDImages"/>
|
---|
201 | <xsl:copy-of select="vb:FloppyImages"/>
|
---|
202 | </DiskRegistry>
|
---|
203 | </xsl:template>
|
---|
204 |
|
---|
205 | <!--
|
---|
206 | * Machine settings
|
---|
207 | -->
|
---|
208 |
|
---|
209 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.1']/
|
---|
210 | vb:Machine//vb:HardDisks"
|
---|
211 | mode="v1.2">
|
---|
212 | <HardDiskAttachments>
|
---|
213 | <xsl:for-each select="vb:HardDisk">
|
---|
214 | <HardDiskAttachment>
|
---|
215 | <xsl:attribute name="hardDisk"><xsl:value-of select="vb:Image/@uuid"/></xsl:attribute>
|
---|
216 | <xsl:apply-templates select="@*"/>
|
---|
217 | </HardDiskAttachment>
|
---|
218 | </xsl:for-each>
|
---|
219 | </HardDiskAttachments>
|
---|
220 | </xsl:template>
|
---|
221 |
|
---|
222 | <!--
|
---|
223 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
224 | * 1.2 => 1.3.pre
|
---|
225 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
226 | -->
|
---|
227 |
|
---|
228 | <!--
|
---|
229 | * all non-root elements that are not explicitly matched are copied as is
|
---|
230 | -->
|
---|
231 | <xsl:template match="@*|node()[../..]" mode="v1.3.pre">
|
---|
232 | <xsl:copy>
|
---|
233 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.3.pre"/>
|
---|
234 | </xsl:copy>
|
---|
235 | </xsl:template>
|
---|
236 |
|
---|
237 | <!--
|
---|
238 | * Global settings
|
---|
239 | -->
|
---|
240 |
|
---|
241 | <!--
|
---|
242 | * Machine settings
|
---|
243 | -->
|
---|
244 |
|
---|
245 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
|
---|
246 | vb:Machine//vb:USBController"
|
---|
247 | mode="v1.3.pre">
|
---|
248 | <xsl:copy>
|
---|
249 | <xsl:apply-templates select="@*|node()" mode="v1.3.pre"/>
|
---|
250 | </xsl:copy>
|
---|
251 | <SATAController enabled="false"/>
|
---|
252 | </xsl:template>
|
---|
253 |
|
---|
254 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.2']/
|
---|
255 | vb:Machine//vb:HardDiskAttachments/vb:HardDiskAttachment"
|
---|
256 | mode="v1.3.pre">
|
---|
257 | <HardDiskAttachment>
|
---|
258 | <xsl:attribute name="hardDisk"><xsl:value-of select="@hardDisk"/></xsl:attribute>
|
---|
259 | <xsl:attribute name="bus">
|
---|
260 | <xsl:choose>
|
---|
261 | <xsl:when test="@bus='ide0'">
|
---|
262 | <xsl:text>IDE</xsl:text>
|
---|
263 | </xsl:when>
|
---|
264 | <xsl:when test="@bus='ide1'">
|
---|
265 | <xsl:text>IDE</xsl:text>
|
---|
266 | </xsl:when>
|
---|
267 | <xsl:otherwise>
|
---|
268 | <xsl:message terminate="yes">
|
---|
269 | Value '<xsl:value-of select="@bus"/>' of 'HardDiskAttachment::bus' attribute is invalid.
|
---|
270 | </xsl:message>
|
---|
271 | </xsl:otherwise>
|
---|
272 | </xsl:choose>
|
---|
273 | </xsl:attribute>
|
---|
274 | <xsl:attribute name="channel">0</xsl:attribute>
|
---|
275 | <xsl:attribute name="device">
|
---|
276 | <xsl:choose>
|
---|
277 | <xsl:when test="@device='master'">
|
---|
278 | <xsl:text>0</xsl:text>
|
---|
279 | </xsl:when>
|
---|
280 | <xsl:when test="@device='slave'">
|
---|
281 | <xsl:text>1</xsl:text>
|
---|
282 | </xsl:when>
|
---|
283 | <xsl:otherwise>
|
---|
284 | <xsl:message terminate="yes">
|
---|
285 | Value '<xsl:value-of select="@device"/>' of 'HardDiskAttachment::device' attribute is invalid.
|
---|
286 | </xsl:message>
|
---|
287 | </xsl:otherwise>
|
---|
288 | </xsl:choose>
|
---|
289 | </xsl:attribute>
|
---|
290 | </HardDiskAttachment>
|
---|
291 | </xsl:template>
|
---|
292 |
|
---|
293 | <!--
|
---|
294 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
295 | * 1.3.pre => 1.3
|
---|
296 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
297 | -->
|
---|
298 |
|
---|
299 | <!--
|
---|
300 | * all non-root elements that are not explicitly matched are copied as is
|
---|
301 | -->
|
---|
302 | <xsl:template match="@*|node()[../..]" mode="v1.3">
|
---|
303 | <xsl:copy>
|
---|
304 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.3"/>
|
---|
305 | </xsl:copy>
|
---|
306 | </xsl:template>
|
---|
307 |
|
---|
308 | <!--
|
---|
309 | * Global settings
|
---|
310 | -->
|
---|
311 |
|
---|
312 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
313 | vb:Global//vb:SystemProperties"
|
---|
314 | mode="v1.3">
|
---|
315 | <xsl:copy>
|
---|
316 | <xsl:apply-templates select="@*[not(name()='defaultSavedStateFolder')]|node()" mode="v1.3"/>
|
---|
317 | </xsl:copy>
|
---|
318 | </xsl:template>
|
---|
319 |
|
---|
320 | <!--
|
---|
321 | * Machine settings
|
---|
322 | -->
|
---|
323 |
|
---|
324 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
325 | vb:Machine//vb:AudioAdapter"
|
---|
326 | mode="v1.3">
|
---|
327 | <xsl:if test="not(../vb:Uart)">
|
---|
328 | <UART/>
|
---|
329 | </xsl:if>
|
---|
330 | <xsl:if test="not(../vb:Lpt)">
|
---|
331 | <LPT/>
|
---|
332 | </xsl:if>
|
---|
333 | <xsl:copy>
|
---|
334 | <xsl:apply-templates select="@*[not(name()='driver')]|node()" mode="v1.3"/>
|
---|
335 | <xsl:attribute name="driver">
|
---|
336 | <xsl:choose>
|
---|
337 | <xsl:when test="@driver='null'">Null</xsl:when>
|
---|
338 | <xsl:when test="@driver='oss'">OSS</xsl:when>
|
---|
339 | <xsl:when test="@driver='alsa'">ALSA</xsl:when>
|
---|
340 | <xsl:when test="@driver='pulse'">Pulse</xsl:when>
|
---|
341 | <xsl:when test="@driver='coreaudio'">CoreAudio</xsl:when>
|
---|
342 | <xsl:when test="@driver='winmm'">WinMM</xsl:when>
|
---|
343 | <xsl:when test="@driver='dsound'">DirectSound</xsl:when>
|
---|
344 | <xsl:when test="@driver='solaudio'">SolAudio</xsl:when>
|
---|
345 | <xsl:when test="@driver='mmpm'">MMPM</xsl:when>
|
---|
346 | <xsl:otherwise>
|
---|
347 | <xsl:message terminate="yes">
|
---|
348 | Value '<xsl:value-of select="@driver"/>' of 'AudioAdapter::driver' attribute is invalid.
|
---|
349 | </xsl:message>
|
---|
350 | </xsl:otherwise>
|
---|
351 | </xsl:choose>
|
---|
352 | </xsl:attribute>
|
---|
353 | </xsl:copy>
|
---|
354 | <xsl:if test="not(../vb:SharedFolders)">
|
---|
355 | <SharedFolders/>
|
---|
356 | </xsl:if>
|
---|
357 | <xsl:if test="not(../vb:Clipboard)">
|
---|
358 | <Clipboard mode="Disabled"/>
|
---|
359 | </xsl:if>
|
---|
360 | <xsl:if test="not(../vb:Guest)">
|
---|
361 | <Guest/>
|
---|
362 | </xsl:if>
|
---|
363 | </xsl:template>
|
---|
364 |
|
---|
365 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
366 | vb:Machine//vb:RemoteDisplay"
|
---|
367 | mode="v1.3">
|
---|
368 | <xsl:copy>
|
---|
369 | <xsl:apply-templates select="@*[not(name()='authType')]|node()" mode="v1.3"/>
|
---|
370 | <xsl:attribute name="authType">
|
---|
371 | <xsl:choose>
|
---|
372 | <xsl:when test="@authType='null'">Null</xsl:when>
|
---|
373 | <xsl:when test="@authType='guest'">Guest</xsl:when>
|
---|
374 | <xsl:when test="@authType='external'">External</xsl:when>
|
---|
375 | <xsl:otherwise>
|
---|
376 | <xsl:message terminate="yes">
|
---|
377 | Value '<xsl:value-of select="@authType"/>' of 'RemoteDisplay::authType' attribute is invalid.
|
---|
378 | </xsl:message>
|
---|
379 | </xsl:otherwise>
|
---|
380 | </xsl:choose>
|
---|
381 | </xsl:attribute>
|
---|
382 | </xsl:copy>
|
---|
383 | </xsl:template>
|
---|
384 |
|
---|
385 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
386 | vb:Machine//vb:BIOS/vb:BootMenu"
|
---|
387 | mode="v1.3">
|
---|
388 | <xsl:copy>
|
---|
389 | <xsl:apply-templates select="@*[not(name()='mode')]|node()" mode="v1.3"/>
|
---|
390 | <xsl:attribute name="mode">
|
---|
391 | <xsl:choose>
|
---|
392 | <xsl:when test="@mode='disabled'">Disabled</xsl:when>
|
---|
393 | <xsl:when test="@mode='menuonly'">MenuOnly</xsl:when>
|
---|
394 | <xsl:when test="@mode='messageandmenu'">MessageAndMenu</xsl:when>
|
---|
395 | <xsl:otherwise>
|
---|
396 | <xsl:message terminate="yes">
|
---|
397 | Value '<xsl:value-of select="@mode"/>' of 'BootMenu::mode' attribute is invalid.
|
---|
398 | </xsl:message>
|
---|
399 | </xsl:otherwise>
|
---|
400 | </xsl:choose>
|
---|
401 | </xsl:attribute>
|
---|
402 | </xsl:copy>
|
---|
403 | </xsl:template>
|
---|
404 |
|
---|
405 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
406 | vb:Machine//vb:USBController/vb:DeviceFilter |
|
---|
407 | vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
408 | vb:Global/vb:USBDeviceFilters/vb:DeviceFilter"
|
---|
409 | mode="v1.3">
|
---|
410 | <xsl:copy>
|
---|
411 | <xsl:apply-templates select="node()" mode="v1.3"/>
|
---|
412 | <xsl:for-each select="@*">
|
---|
413 | <xsl:choose>
|
---|
414 | <xsl:when test="name()='vendorid'">
|
---|
415 | <xsl:attribute name="vendorId"><xsl:value-of select="."/></xsl:attribute>
|
---|
416 | </xsl:when>
|
---|
417 | <xsl:when test="name()='productid'">
|
---|
418 | <xsl:attribute name="productId"><xsl:value-of select="."/></xsl:attribute>
|
---|
419 | </xsl:when>
|
---|
420 | <xsl:when test="name()='serialnumber'">
|
---|
421 | <xsl:attribute name="serialNumber"><xsl:value-of select="."/></xsl:attribute>
|
---|
422 | </xsl:when>
|
---|
423 | <xsl:otherwise>
|
---|
424 | <xsl:apply-templates select="." mode="v1.3"/>
|
---|
425 | </xsl:otherwise>
|
---|
426 | </xsl:choose>
|
---|
427 | </xsl:for-each>
|
---|
428 | </xsl:copy>
|
---|
429 | </xsl:template>
|
---|
430 |
|
---|
431 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
432 | vb:Machine//vb:Guest"
|
---|
433 | mode="v1.3">
|
---|
434 | <xsl:copy>
|
---|
435 | <xsl:apply-templates select="node()" mode="v1.3"/>
|
---|
436 | <xsl:for-each select="@*">
|
---|
437 | <xsl:choose>
|
---|
438 | <xsl:when test="name()='MemoryBalloonSize'">
|
---|
439 | <xsl:attribute name="memoryBalloonSize"><xsl:value-of select="."/></xsl:attribute>
|
---|
440 | </xsl:when>
|
---|
441 | <xsl:when test="name()='StatisticsUpdateInterval'">
|
---|
442 | <xsl:attribute name="statisticsUpdateInterval"><xsl:value-of select="."/></xsl:attribute>
|
---|
443 | </xsl:when>
|
---|
444 | <xsl:otherwise>
|
---|
445 | <xsl:apply-templates select="node()" mode="v1.3"/>
|
---|
446 | </xsl:otherwise>
|
---|
447 | </xsl:choose>
|
---|
448 | </xsl:for-each>
|
---|
449 | </xsl:copy>
|
---|
450 | </xsl:template>
|
---|
451 |
|
---|
452 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
453 | vb:Machine//vb:Uart"
|
---|
454 | mode="v1.3">
|
---|
455 | <UART>
|
---|
456 | <xsl:apply-templates select="@*|node()" mode="v1.3"/>
|
---|
457 | </UART>
|
---|
458 | </xsl:template>
|
---|
459 |
|
---|
460 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3.pre']/
|
---|
461 | vb:Machine//vb:Lpt"
|
---|
462 | mode="v1.3">
|
---|
463 | <LPT>
|
---|
464 | <xsl:apply-templates select="@*|node()" mode="v1.3"/>
|
---|
465 | </LPT>
|
---|
466 | </xsl:template>
|
---|
467 |
|
---|
468 | <!--
|
---|
469 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
470 | * 1.3 => 1.4
|
---|
471 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
472 | -->
|
---|
473 |
|
---|
474 | <!--
|
---|
475 | * all non-root elements that are not explicitly matched are copied as is
|
---|
476 | -->
|
---|
477 | <xsl:template match="@*|node()[../..]" mode="v1.4">
|
---|
478 | <xsl:copy>
|
---|
479 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.4"/>
|
---|
480 | </xsl:copy>
|
---|
481 | </xsl:template>
|
---|
482 |
|
---|
483 | <!--
|
---|
484 | * Global settings
|
---|
485 | -->
|
---|
486 |
|
---|
487 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
488 | vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk |
|
---|
489 | vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
490 | vb:Global/vb:DiskRegistry/vb:HardDisks//vb:DiffHardDisk"
|
---|
491 | mode="v1.4-HardDisk-format-location">
|
---|
492 | <xsl:attribute name="format">
|
---|
493 | <xsl:choose>
|
---|
494 | <xsl:when test="*[self::vb:VirtualDiskImage][1]">VDI</xsl:when>
|
---|
495 | <xsl:when test="*[self::vb:VMDKImage][1]">VMDK</xsl:when>
|
---|
496 | <xsl:when test="*[self::vb:VHDImage][1]">VHD</xsl:when>
|
---|
497 | <xsl:when test="*[self::vb:ISCSIHardDisk][1]">iSCSI</xsl:when>
|
---|
498 | <xsl:when test="*[self::vb:CustomHardDisk][1]">
|
---|
499 | <xsl:value-of select="@format"/>
|
---|
500 | </xsl:when>
|
---|
501 | <xsl:otherwise>
|
---|
502 | <xsl:message terminate="yes">
|
---|
503 | Sub-element '<xsl:value-of select="name(*[1])"/>' of 'HardDisk' element is invalid.
|
---|
504 | </xsl:message>
|
---|
505 | </xsl:otherwise>
|
---|
506 | </xsl:choose>
|
---|
507 | </xsl:attribute>
|
---|
508 | <xsl:attribute name="location">
|
---|
509 | <xsl:choose>
|
---|
510 | <xsl:when test="*[self::vb:VirtualDiskImage][1]">
|
---|
511 | <xsl:value-of select="vb:VirtualDiskImage/@filePath"/>
|
---|
512 | </xsl:when>
|
---|
513 | <xsl:when test="*[self::vb:VMDKImage][1]">
|
---|
514 | <xsl:value-of select="vb:VMDKImage/@filePath"/>
|
---|
515 | </xsl:when>
|
---|
516 | <xsl:when test="*[self::vb:VHDImage][1]">
|
---|
517 | <xsl:value-of select="vb:VHDImage/@filePath"/>
|
---|
518 | </xsl:when>
|
---|
519 | <xsl:when test="*[self::vb:CustomHardDisk][1]">
|
---|
520 | <xsl:value-of select="vb:CustomHardDisk/@location"/>
|
---|
521 | </xsl:when>
|
---|
522 | <xsl:when test="*[self::vb:ISCSIHardDisk][1]">
|
---|
523 | <xsl:text>iscsi://</xsl:text>
|
---|
524 | <xsl:if test="vb:ISCSIHardDisk/@userName">
|
---|
525 | <xsl:value-of select="vb:ISCSIHardDisk/@userName"/>
|
---|
526 | <!-- note that for privacy reasons we don't show the password in the
|
---|
527 | location string -->
|
---|
528 | <xsl:text>@</xsl:text>
|
---|
529 | </xsl:if>
|
---|
530 | <xsl:if test="vb:ISCSIHardDisk/@server">
|
---|
531 | <xsl:value-of select="vb:ISCSIHardDisk/@server"/>
|
---|
532 | <xsl:if test="vb:ISCSIHardDisk/@port">
|
---|
533 | <xsl:value-of select="concat(':',vb:ISCSIHardDisk/@port)"/>
|
---|
534 | </xsl:if>
|
---|
535 | </xsl:if>
|
---|
536 | <xsl:if test="vb:ISCSIHardDisk/@target">
|
---|
537 | <xsl:value-of select="concat('/',vb:ISCSIHardDisk/@target)"/>
|
---|
538 | </xsl:if>
|
---|
539 | <xsl:if test="vb:ISCSIHardDisk/@lun">
|
---|
540 | <xsl:value-of select="concat('/enc',vb:ISCSIHardDisk/@lun)"/>
|
---|
541 | </xsl:if>
|
---|
542 | <xsl:if test="not(vb:ISCSIHardDisk/@server) or not(vb:ISCSIHardDisk/@target)">
|
---|
543 | <xsl:message terminate="yes">
|
---|
544 | Required attribute 'server' or 'target' is missing from ISCSIHardDisk element!
|
---|
545 | </xsl:message>
|
---|
546 | </xsl:if>
|
---|
547 | </xsl:when>
|
---|
548 | </xsl:choose>
|
---|
549 | </xsl:attribute>
|
---|
550 | <xsl:if test="*[self::vb:ISCSIHardDisk][1]">
|
---|
551 | <xsl:choose>
|
---|
552 | <xsl:when test="vb:ISCSIHardDisk/@server and vb:ISCSIHardDisk/@port">
|
---|
553 | <xsl:element name="Property">
|
---|
554 | <xsl:attribute name="name">TargetAddress</xsl:attribute>
|
---|
555 | <xsl:attribute name="value">
|
---|
556 | <xsl:value-of select="concat(vb:ISCSIHardDisk/@server,
|
---|
557 | ':',vb:ISCSIHardDisk/@port)"/>
|
---|
558 | </xsl:attribute>
|
---|
559 | </xsl:element>
|
---|
560 | </xsl:when>
|
---|
561 | <xsl:when test="vb:ISCSIHardDisk/@server">
|
---|
562 | <xsl:element name="Property">
|
---|
563 | <xsl:attribute name="name">TargetAddress</xsl:attribute>
|
---|
564 | <xsl:attribute name="value">
|
---|
565 | <xsl:value-of select="vb:ISCSIHardDisk/@server"/>
|
---|
566 | </xsl:attribute>
|
---|
567 | </xsl:element>
|
---|
568 | </xsl:when>
|
---|
569 | </xsl:choose>
|
---|
570 | <xsl:if test="vb:ISCSIHardDisk/@target">
|
---|
571 | <xsl:element name="Property">
|
---|
572 | <xsl:attribute name="name">TargetName</xsl:attribute>
|
---|
573 | <xsl:attribute name="value">
|
---|
574 | <xsl:value-of select="vb:ISCSIHardDisk/@target"/>
|
---|
575 | </xsl:attribute>
|
---|
576 | </xsl:element>
|
---|
577 | </xsl:if>
|
---|
578 | <xsl:if test="vb:ISCSIHardDisk/@userName">
|
---|
579 | <xsl:element name="Property">
|
---|
580 | <xsl:attribute name="name">InitiatorUsername</xsl:attribute>
|
---|
581 | <xsl:attribute name="value">
|
---|
582 | <xsl:value-of select="vb:ISCSIHardDisk/@userName"/>
|
---|
583 | </xsl:attribute>
|
---|
584 | </xsl:element>
|
---|
585 | </xsl:if>
|
---|
586 | <xsl:if test="vb:ISCSIHardDisk/@password">
|
---|
587 | <xsl:element name="Property">
|
---|
588 | <xsl:attribute name="name">InitiatorSecret</xsl:attribute>
|
---|
589 | <xsl:attribute name="value">
|
---|
590 | <xsl:value-of select="vb:ISCSIHardDisk/@password"/>
|
---|
591 | </xsl:attribute>
|
---|
592 | </xsl:element>
|
---|
593 | </xsl:if>
|
---|
594 | <xsl:if test="vb:ISCSIHardDisk/@lun">
|
---|
595 | <xsl:element name="Property">
|
---|
596 | <xsl:attribute name="name">LUN</xsl:attribute>
|
---|
597 | <xsl:attribute name="value">
|
---|
598 | <xsl:value-of select="concat('enc',vb:ISCSIHardDisk/@lun)"/>
|
---|
599 | </xsl:attribute>
|
---|
600 | </xsl:element>
|
---|
601 | </xsl:if>
|
---|
602 | </xsl:if>
|
---|
603 | </xsl:template>
|
---|
604 |
|
---|
605 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
606 | vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk"
|
---|
607 | mode="v1.4">
|
---|
608 | <HardDisk>
|
---|
609 | <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
|
---|
610 | <xsl:attribute name="type">
|
---|
611 | <xsl:choose>
|
---|
612 | <xsl:when test="@type='normal'">Normal</xsl:when>
|
---|
613 | <xsl:when test="@type='immutable'">Immutable</xsl:when>
|
---|
614 | <xsl:when test="@type='writethrough'">Writethrough</xsl:when>
|
---|
615 | <xsl:otherwise>
|
---|
616 | <xsl:message terminate="yes">
|
---|
617 | Value '<xsl:value-of select="@type"/>' of 'HardDisk::type' attribute is invalid.
|
---|
618 | </xsl:message>
|
---|
619 | </xsl:otherwise>
|
---|
620 | </xsl:choose>
|
---|
621 | </xsl:attribute>
|
---|
622 | <xsl:apply-templates select="." mode="v1.4-HardDisk-format-location"/>
|
---|
623 | <xsl:apply-templates select="vb:DiffHardDisk" mode="v1.4"/>
|
---|
624 | </HardDisk>
|
---|
625 | </xsl:template>
|
---|
626 |
|
---|
627 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
628 | vb:Global/vb:DiskRegistry/vb:HardDisks/vb:HardDisk//
|
---|
629 | vb:DiffHardDisk"
|
---|
630 | mode="v1.4">
|
---|
631 | <HardDisk>
|
---|
632 | <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
|
---|
633 | <xsl:apply-templates select="." mode="v1.4-HardDisk-format-location"/>
|
---|
634 | <xsl:apply-templates select="vb:DiffHardDisk" mode="v1.4"/>
|
---|
635 | </HardDisk>
|
---|
636 | </xsl:template>
|
---|
637 |
|
---|
638 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
639 | vb:Global/vb:DiskRegistry/vb:DVDImages/vb:Image |
|
---|
640 | vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
641 | vb:Global/vb:DiskRegistry/vb:FloppyImages/vb:Image"
|
---|
642 | mode="v1.4">
|
---|
643 | <Image>
|
---|
644 | <xsl:attribute name="uuid"><xsl:value-of select="@uuid"/></xsl:attribute>
|
---|
645 | <xsl:attribute name="location"><xsl:value-of select="@src"/></xsl:attribute>
|
---|
646 | </Image>
|
---|
647 | </xsl:template>
|
---|
648 |
|
---|
649 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
650 | vb:Global/vb:DiskRegistry"
|
---|
651 | mode="v1.4">
|
---|
652 | <MediaRegistry>
|
---|
653 | <HardDisks>
|
---|
654 | <xsl:apply-templates select="vb:HardDisks/vb:HardDisk" mode="v1.4"/>
|
---|
655 | </HardDisks>
|
---|
656 | <DVDImages>
|
---|
657 | <xsl:apply-templates select="vb:DVDImages/vb:Image" mode="v1.4"/>
|
---|
658 | </DVDImages>
|
---|
659 | <FloppyImages>
|
---|
660 | <xsl:apply-templates select="vb:FloppyImages/vb:Image" mode="v1.4"/>
|
---|
661 | </FloppyImages>
|
---|
662 | </MediaRegistry>
|
---|
663 | </xsl:template>
|
---|
664 |
|
---|
665 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
666 | vb:Global/vb:SystemProperties"
|
---|
667 | mode="v1.4">
|
---|
668 | <SystemProperties>
|
---|
669 | <xsl:apply-templates select="@*[not(name()='defaultVDIFolder')]|node()" mode="v1.4"/>
|
---|
670 | <!-- use the @defaultVDIFolder value for @defaultHardDiskFolder only when it
|
---|
671 | differs from the default (VDI) and otherwise simply delete it to let
|
---|
672 | VBoxSVC set the correct new default value -->
|
---|
673 | <xsl:if test="@defaultVDIFolder and not(translate(@defaultVDIFolder,'vdi','VDI')='VDI')">
|
---|
674 | <xsl:attribute name="defaultHardDiskFolder">
|
---|
675 | <xsl:value-of select="@defaultVDIFolder"/>
|
---|
676 | </xsl:attribute>
|
---|
677 | </xsl:if>
|
---|
678 | </SystemProperties>
|
---|
679 | </xsl:template>
|
---|
680 |
|
---|
681 | <!--
|
---|
682 | * Machine settings
|
---|
683 | -->
|
---|
684 |
|
---|
685 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.3']/
|
---|
686 | vb:Machine/vb:Hardware"
|
---|
687 | mode="v1.4">
|
---|
688 | <!-- add version attribute to Hardware if parent Machine has a stateFile attribute -->
|
---|
689 | <xsl:copy>
|
---|
690 | <xsl:if test="../@stateFile">
|
---|
691 | <xsl:attribute name="version">1</xsl:attribute>
|
---|
692 | </xsl:if>
|
---|
693 | <xsl:apply-templates select="node()" mode="v1.4"/>
|
---|
694 | </xsl:copy>
|
---|
695 | </xsl:template>
|
---|
696 |
|
---|
697 |
|
---|
698 | <!--
|
---|
699 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
700 | * 1.4 => 1.5
|
---|
701 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
702 | -->
|
---|
703 |
|
---|
704 | <!--
|
---|
705 | * all non-root elements that are not explicitly matched are copied as is
|
---|
706 | -->
|
---|
707 | <xsl:template match="@*|node()[../..]" mode="v1.5">
|
---|
708 | <xsl:copy>
|
---|
709 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.5"/>
|
---|
710 | </xsl:copy>
|
---|
711 | </xsl:template>
|
---|
712 |
|
---|
713 | <!--
|
---|
714 | * Global settings
|
---|
715 | -->
|
---|
716 |
|
---|
717 | <!--
|
---|
718 | * Machine settings
|
---|
719 | -->
|
---|
720 |
|
---|
721 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
|
---|
722 | vb:Machine"
|
---|
723 | mode="v1.5">
|
---|
724 | <xsl:copy>
|
---|
725 | <xsl:attribute name="OSType">
|
---|
726 | <xsl:choose>
|
---|
727 | <xsl:when test="@OSType='unknown'">Other</xsl:when>
|
---|
728 | <xsl:when test="@OSType='dos'">DOS</xsl:when>
|
---|
729 | <xsl:when test="@OSType='win31'">Windows31</xsl:when>
|
---|
730 | <xsl:when test="@OSType='win95'">Windows95</xsl:when>
|
---|
731 | <xsl:when test="@OSType='win98'">Windows98</xsl:when>
|
---|
732 | <xsl:when test="@OSType='winme'">WindowsMe</xsl:when>
|
---|
733 | <xsl:when test="@OSType='winnt4'">WindowsNT4</xsl:when>
|
---|
734 | <xsl:when test="@OSType='win2k'">Windows2000</xsl:when>
|
---|
735 | <xsl:when test="@OSType='winxp'">WindowsXP</xsl:when>
|
---|
736 | <xsl:when test="@OSType='win2k3'">Windows2003</xsl:when>
|
---|
737 | <xsl:when test="@OSType='winvista'">WindowsVista</xsl:when>
|
---|
738 | <xsl:when test="@OSType='win2k8'">Windows2008</xsl:when>
|
---|
739 | <xsl:when test="@OSType='os2warp3'">OS2Warp3</xsl:when>
|
---|
740 | <xsl:when test="@OSType='os2warp4'">OS2Warp4</xsl:when>
|
---|
741 | <xsl:when test="@OSType='os2warp45'">OS2Warp45</xsl:when>
|
---|
742 | <xsl:when test="@OSType='ecs'">OS2eCS</xsl:when>
|
---|
743 | <xsl:when test="@OSType='linux22'">Linux22</xsl:when>
|
---|
744 | <xsl:when test="@OSType='linux24'">Linux24</xsl:when>
|
---|
745 | <xsl:when test="@OSType='linux26'">Linux26</xsl:when>
|
---|
746 | <xsl:when test="@OSType='archlinux'">ArchLinux</xsl:when>
|
---|
747 | <xsl:when test="@OSType='debian'">Debian</xsl:when>
|
---|
748 | <xsl:when test="@OSType='opensuse'">OpenSUSE</xsl:when>
|
---|
749 | <xsl:when test="@OSType='fedoracore'">Fedora</xsl:when>
|
---|
750 | <xsl:when test="@OSType='gentoo'">Gentoo</xsl:when>
|
---|
751 | <xsl:when test="@OSType='mandriva'">Mandriva</xsl:when>
|
---|
752 | <xsl:when test="@OSType='redhat'">RedHat</xsl:when>
|
---|
753 | <xsl:when test="@OSType='ubuntu'">Ubuntu</xsl:when>
|
---|
754 | <xsl:when test="@OSType='xandros'">Xandros</xsl:when>
|
---|
755 | <xsl:when test="@OSType='freebsd'">FreeBSD</xsl:when>
|
---|
756 | <xsl:when test="@OSType='openbsd'">OpenBSD</xsl:when>
|
---|
757 | <xsl:when test="@OSType='netbsd'">NetBSD</xsl:when>
|
---|
758 | <xsl:when test="@OSType='netware'">Netware</xsl:when>
|
---|
759 | <xsl:when test="@OSType='solaris'">Solaris</xsl:when>
|
---|
760 | <xsl:when test="@OSType='opensolaris'">OpenSolaris</xsl:when>
|
---|
761 | <xsl:when test="@OSType='l4'">L4</xsl:when>
|
---|
762 | </xsl:choose>
|
---|
763 | </xsl:attribute>
|
---|
764 | <xsl:apply-templates select="@*[name()!='OSType']" mode="v1.5"/>
|
---|
765 | <xsl:apply-templates select="node()" mode="v1.5"/>
|
---|
766 | </xsl:copy>
|
---|
767 | </xsl:template>
|
---|
768 |
|
---|
769 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
|
---|
770 | vb:Machine//vb:Hardware/vb:Display"
|
---|
771 | mode="v1.5">
|
---|
772 | <xsl:copy>
|
---|
773 | <xsl:apply-templates select="node()" mode="v1.5"/>
|
---|
774 | <xsl:for-each select="@*">
|
---|
775 | <xsl:choose>
|
---|
776 | <xsl:when test="name()='MonitorCount'">
|
---|
777 | <xsl:attribute name="monitorCount"><xsl:value-of select="."/></xsl:attribute>
|
---|
778 | </xsl:when>
|
---|
779 | <xsl:when test="name()='Accelerate3D'">
|
---|
780 | <xsl:attribute name="accelerate3D"><xsl:value-of select="."/></xsl:attribute>
|
---|
781 | </xsl:when>
|
---|
782 | <xsl:otherwise>
|
---|
783 | <xsl:apply-templates select="." mode="v1.5"/>
|
---|
784 | </xsl:otherwise>
|
---|
785 | </xsl:choose>
|
---|
786 | </xsl:for-each>
|
---|
787 | </xsl:copy>
|
---|
788 | </xsl:template>
|
---|
789 |
|
---|
790 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.4']/
|
---|
791 | vb:Machine//vb:Hardware/vb:CPU"
|
---|
792 | mode="v1.5">
|
---|
793 | <xsl:copy>
|
---|
794 | <xsl:if test="vb:CPUCount/@count">
|
---|
795 | <xsl:attribute name="count"><xsl:value-of select="vb:CPUCount/@count"/></xsl:attribute>
|
---|
796 | </xsl:if>
|
---|
797 | <xsl:apply-templates select="@*" mode="v1.5"/>
|
---|
798 | <xsl:apply-templates select="node()[not(self::vb:CPUCount)]" mode="v1.5"/>
|
---|
799 | </xsl:copy>
|
---|
800 | </xsl:template>
|
---|
801 |
|
---|
802 |
|
---|
803 | <!--
|
---|
804 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
805 | * 1.5 => 1.6
|
---|
806 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
807 | -->
|
---|
808 |
|
---|
809 |
|
---|
810 | <!--
|
---|
811 | * all non-root elements that are not explicitly matched are copied as is
|
---|
812 | -->
|
---|
813 | <xsl:template match="@*|node()[../..]" mode="v1.6">
|
---|
814 | <xsl:copy>
|
---|
815 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.6"/>
|
---|
816 | </xsl:copy>
|
---|
817 | </xsl:template>
|
---|
818 |
|
---|
819 | <!--
|
---|
820 | * Global settings
|
---|
821 | -->
|
---|
822 |
|
---|
823 | <!--
|
---|
824 | * Machine settings
|
---|
825 | -->
|
---|
826 |
|
---|
827 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.5' and
|
---|
828 | not(substring-after(@version,'-')='windows')]/
|
---|
829 | vb:Machine//vb:Hardware/vb:Network/vb:Adapter/
|
---|
830 | vb:HostInterface[@TAPSetup or @TAPTerminate]"
|
---|
831 | mode="v1.6">
|
---|
832 | <!-- just remove the node -->
|
---|
833 | </xsl:template>
|
---|
834 |
|
---|
835 |
|
---|
836 | <!--
|
---|
837 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
838 | * 1.6 => 1.7
|
---|
839 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
840 | -->
|
---|
841 | <!--
|
---|
842 | * all non-root elements that are not explicitly matched are copied as is
|
---|
843 | -->
|
---|
844 | <xsl:template match="@*|node()[../..]" mode="v1.7">
|
---|
845 | <xsl:copy>
|
---|
846 | <xsl:apply-templates select="@*|node()[../..]" mode="v1.7"/>
|
---|
847 | </xsl:copy>
|
---|
848 | </xsl:template>
|
---|
849 |
|
---|
850 | <!--
|
---|
851 | * Global settings
|
---|
852 | -->
|
---|
853 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
854 | vb:Global"
|
---|
855 | mode="v1.7" >
|
---|
856 | <xsl:copy>
|
---|
857 | <xsl:apply-templates mode="v1.7" />
|
---|
858 | <NetserviceRegistry>
|
---|
859 | <DhcpServers>
|
---|
860 | <xsl:choose>
|
---|
861 | <xsl:when test="substring-after(../@version,'-')='windows'">
|
---|
862 | <DhcpServer networkName="HostInterfaceNetworking-VirtualBox Host-Only Network Adapter"
|
---|
863 | IPAddress="192.168.56.2" networkMask="255.255.255.0"
|
---|
864 | lowerIP="192.168.56.3" upperIP="192.168.56.255"
|
---|
865 | enabled="1"/>
|
---|
866 | </xsl:when>
|
---|
867 | <xsl:otherwise>
|
---|
868 | <DhcpServer networkName="HostInterfaceNetworking-vboxnet0"
|
---|
869 | IPAddress="192.168.56.2" networkMask="255.255.255.0"
|
---|
870 | lowerIP="192.168.56.3" upperIP="192.168.56.255"
|
---|
871 | enabled="1"/>
|
---|
872 | </xsl:otherwise>
|
---|
873 | </xsl:choose>
|
---|
874 | </DhcpServers>
|
---|
875 | </NetserviceRegistry>
|
---|
876 | </xsl:copy>
|
---|
877 | </xsl:template>
|
---|
878 |
|
---|
879 | <!--
|
---|
880 | * Machine settings
|
---|
881 | -->
|
---|
882 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
883 | vb:Machine/vb:Snapshots"
|
---|
884 | mode="v1.7">
|
---|
885 | <xsl:for-each select="vb:Snapshot">
|
---|
886 | <xsl:apply-templates select="." mode="v1.7"/>
|
---|
887 | </xsl:for-each>
|
---|
888 | </xsl:template>
|
---|
889 |
|
---|
890 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
891 | vb:Machine/vb:HardDiskAttachments |
|
---|
892 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
893 | vb:Machine/vb:Snapshot/vb:HardDiskAttachments |
|
---|
894 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
895 | vb:Machine/vb:Snapshot/vb:Snapshots//vb:Snapshot/vb:HardDiskAttachments"
|
---|
896 | mode="v1.7">
|
---|
897 | <StorageControllers>
|
---|
898 | <StorageController name="IDE">
|
---|
899 | <xsl:choose>
|
---|
900 | <xsl:when test="not(../vb:Hardware/vb:BIOS/vb:IDEController)">
|
---|
901 | <xsl:attribute name="type">PIIX3</xsl:attribute>
|
---|
902 | </xsl:when>
|
---|
903 | <xsl:otherwise>
|
---|
904 | <xsl:attribute name="type"><xsl:value-of select="../vb:Hardware/vb:BIOS/vb:IDEController/@type"/></xsl:attribute>
|
---|
905 | </xsl:otherwise>
|
---|
906 | </xsl:choose>
|
---|
907 | <xsl:attribute name="PortCount">2</xsl:attribute>
|
---|
908 | <xsl:for-each select="./vb:HardDiskAttachment[@bus = 'IDE']">
|
---|
909 | <xsl:apply-templates select="." mode="v1.7-attached-device"/>
|
---|
910 | </xsl:for-each>
|
---|
911 | </StorageController>
|
---|
912 | <xsl:if test="../vb:Hardware/vb:SATAController/@enabled='true'">
|
---|
913 | <StorageController name="SATA">
|
---|
914 | <xsl:attribute name="type">AHCI</xsl:attribute>
|
---|
915 | <xsl:attribute name="PortCount">
|
---|
916 | <xsl:value-of select="../vb:Hardware/vb:SATAController/@PortCount"/>
|
---|
917 | </xsl:attribute>
|
---|
918 | <xsl:attribute name="IDE0MasterEmulationPort">
|
---|
919 | <xsl:value-of select="../vb:Hardware/vb:SATAController/@IDE0MasterEmulationPort"/>
|
---|
920 | </xsl:attribute>
|
---|
921 | <xsl:attribute name="IDE0SlaveEmulationPort">
|
---|
922 | <xsl:value-of select="../vb:Hardware/vb:SATAController/@IDE0SlaveEmulationPort"/>
|
---|
923 | </xsl:attribute>
|
---|
924 | <xsl:attribute name="IDE1MasterEmulationPort">
|
---|
925 | <xsl:value-of select="../vb:Hardware/vb:SATAController/@IDE1MasterEmulationPort"/>
|
---|
926 | </xsl:attribute>
|
---|
927 | <xsl:attribute name="IDE1SlaveEmulationPort">
|
---|
928 | <xsl:value-of select="../vb:Hardware/vb:SATAController/@IDE1SlaveEmulationPort"/>
|
---|
929 | </xsl:attribute>
|
---|
930 | <xsl:for-each select="./vb:HardDiskAttachment[@bus = 'SATA']">
|
---|
931 | <xsl:apply-templates select="." mode="v1.7-attached-device"/>
|
---|
932 | </xsl:for-each>
|
---|
933 | </StorageController>
|
---|
934 | </xsl:if>
|
---|
935 | </StorageControllers>
|
---|
936 | </xsl:template>
|
---|
937 |
|
---|
938 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
939 | vb:Machine/vb:HardDiskAttachments/vb:HardDiskAttachment |
|
---|
940 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
941 | vb:Machine/vb:Snapshot/vb:HardDiskAttachments/vb:HardDiskAttachment |
|
---|
942 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
943 | vb:Machine/vb:Snapshot/vb:Snapshots//vb:Snapshot/vb:HardDiskAttachments/
|
---|
944 | vb:HardDiskAttachment"
|
---|
945 | mode="v1.7-attached-device">
|
---|
946 | <AttachedDevice>
|
---|
947 | <xsl:attribute name="type">HardDisk</xsl:attribute>
|
---|
948 | <xsl:attribute name="port"><xsl:value-of select="@channel"/></xsl:attribute>
|
---|
949 | <xsl:attribute name="device"><xsl:value-of select="@device"/></xsl:attribute>
|
---|
950 | <xsl:element name="Image">
|
---|
951 | <xsl:attribute name="uuid"><xsl:value-of select="@hardDisk"/></xsl:attribute>
|
---|
952 | </xsl:element>
|
---|
953 | </AttachedDevice>
|
---|
954 | </xsl:template>
|
---|
955 |
|
---|
956 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
957 | vb:Machine//vb:Hardware/vb:BIOS/vb:IDEController |
|
---|
958 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
959 | vb:Machine//vb:Snapshot/vb:Hardware/vb:BIOS/vb:IDEController |
|
---|
960 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
961 | vb:Machine/vb:Snapshot/vb:Snapshots//vb:Snapshot/vb:Hardware/vb:BIOS/vb:IDEController"
|
---|
962 | mode="v1.7">
|
---|
963 | <!-- just remove the node -->
|
---|
964 | </xsl:template>
|
---|
965 |
|
---|
966 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
967 | vb:Machine/vb:Hardware/vb:SATAController |
|
---|
968 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
969 | vb:Machine/vb:Snapshot/vb:Hardware/vb:SATAController |
|
---|
970 | vb:VirtualBox[substring-before(@version,'-')='1.6']/
|
---|
971 | vb:Machine/vb:Snapshot/vb:Snapshots//vb:Snapshot/vb:Hardware/vb:SATAController"
|
---|
972 | mode="v1.7">
|
---|
973 | <!-- just remove the node -->
|
---|
974 | </xsl:template>
|
---|
975 |
|
---|
976 | <!--
|
---|
977 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
---|
978 | -->
|
---|
979 |
|
---|
980 |
|
---|
981 | <!-- @todo add lastStateChange with the current timestamp if missing.
|
---|
982 | * current-dateTime() is available only in XPath 2.0 so we will need to pass
|
---|
983 | * the current time as a parameter to the XSLT processor. -->
|
---|
984 | <!--
|
---|
985 | <xsl:template match="vb:VirtualBox[substring-before(@version,'-')='Xo.Yo']/
|
---|
986 | vb:Machine"
|
---|
987 | mode="X.Y">
|
---|
988 | <xsl:copy>
|
---|
989 | <xsl:if test="not(@lastStateChange)">
|
---|
990 | <xsl:attribute name="lastStateChange">
|
---|
991 | <xsl:value-of select="current-dateTime()"/>
|
---|
992 | </xsl:attribute>
|
---|
993 | </xsl:if>
|
---|
994 | <xsl:apply-templates select="@*|node()" mode="vX.Y"/>
|
---|
995 | </xsl:copy>
|
---|
996 | </xsl:template>
|
---|
997 | -->
|
---|
998 |
|
---|
999 | </xsl:stylesheet>
|
---|