root/juggler/trunk/modules/vrjuggler/data/xslt/2.2-2.3.xsl

Revision 20974, 7.7 kB (checked in by patrick, 7 months ago)

Copyright update.

  • Property svn:eol-style set to native
Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- *********** <auto-copyright.pl BEGIN do not edit this line> *********** -->
4 <!--
5  VR Juggler is (C) Copyright 1998-2008 by Iowa State University
6
7  Original Authors:
8    Allen Bierbaum, Christopher Just,
9    Patrick Hartling, Kevin Meinert,
10    Carolina Cruz-Neira, Albert Baker
11
12  This library is free software; you can redistribute it and/or
13  modify it under the terms of the GNU Library General Public
14  License as published by the Free Software Foundation; either
15  version 2 of the License, or (at your option) any later version.
16
17  This library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  Library General Public License for more details.
21
22  You should have received a copy of the GNU Library General Public
23  License along with this library; if not, write to the
24  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25  Boston, MA 02111-1307, USA.
26  -->
27 <!-- ************ <auto-copyright.pl END do not edit this line> ************ -->
28
29 <!--
30
31    This stylesheet provides an upgrade path for VR Juggler 2.2 configuration
32    files to changes made for VR Juggler 2.3.
33
34       xsltproc -o new-file.jconf 2.2-2.3.xsl old-file.jconf
35
36    or
37
38       xalan -in old-file.jconf -xsl 2.2-2.3.xsl -out new-file.jconf
39
40 -->
41
42 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
43                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44                 xmlns:jconf="http://www.vrjuggler.org/jccl/xsd/3.0/configuration">
45    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
46
47    <!-- Define a handy way to insert newlines when necessary. -->
48    <xsl:variable name="newline">
49 <xsl:text>
50 </xsl:text>
51    </xsl:variable>
52
53    <!-- The namespace for JCCL configuration files. -->
54    <xsl:variable name="jconf_schema">
55       <xsl:text>http://www.vrjuggler.org/jccl/xsd/3.0/configuration</xsl:text>
56    </xsl:variable>
57
58    <!-- The schema for JCCL configuration files. -->
59    <xsl:variable name="jconf_schema_file">
60       <xsl:text>http://www.vrjuggler.org/jccl/xsd/3.0/configuration.xsd</xsl:text>
61    </xsl:variable>
62
63    <xsl:template match="/">
64      <!-- Add the file format version information. -->
65      <xsl:processing-instruction name="org-vrjuggler-jccl-settings">configuration.version="3.0"</xsl:processing-instruction>
66       <xsl:value-of select="$newline"/>
67
68       <xsl:apply-templates />
69
70       <xsl:message>
71          <xsl:text>Processing is complete.  You should now use VRJConfig</xsl:text>
72          <xsl:value-of select="$newline"/>
73          <xsl:text>to verify the results and make any necessary changes.</xsl:text>
74          <xsl:value-of select="$newline"/>
75       </xsl:message>
76    </xsl:template>
77
78    <xsl:template match="jconf:configuration">
79       <xsl:copy>
80          <xsl:copy-of select="./@*" />
81          <xsl:apply-templates />
82       </xsl:copy>
83    </xsl:template>
84
85    <xsl:template match="jconf:include">
86       <xsl:copy-of select="." />
87    </xsl:template>
88
89    <xsl:template match="jconf:elements">
90       <xsl:copy>
91          <xsl:apply-templates />
92       </xsl:copy>
93    </xsl:template>
94
95    <xsl:template match="jconf:cluster_manager">
96       <xsl:choose>
97          <xsl:when test="@version = '2'">
98             <xsl:element name="cluster_manager">
99                <xsl:attribute name="name">
100                   <xsl:value-of select="@name" />
101                </xsl:attribute>
102                <xsl:attribute name="version">
103                   <xsl:text>3</xsl:text>
104                </xsl:attribute>
105
106                <xsl:for-each select="./jconf:plugin_path">
107                   <xsl:copy-of select="." />
108                </xsl:for-each>
109
110                <xsl:for-each select="./jconf:plugin">
111                   <xsl:variable name="plugin_name">
112                      <xsl:value-of select="." />
113                   </xsl:variable>
114                   <xsl:choose>
115                      <xsl:when test="$plugin_name = 'StartBarrierPlugin'">
116                         <xsl:message>
117                            <xsl:text>Removing reference to StartBarrierPlugin.</xsl:text>
118                         </xsl:message>
119                      </xsl:when>
120                      <xsl:when test="$plugin_name = 'SwapLockTCPPlugin'">
121                         <xsl:message>
122                            <xsl:text>Removing reference to SwapLockTCPPlugin.</xsl:text>
123                         </xsl:message>
124                      </xsl:when>
125                      <xsl:when test="$plugin_name = 'SwapLockWiredPlugin'">
126                         <xsl:message>
127                            <xsl:text>Removing reference to SwapLockWiredPlugin.</xsl:text>
128                         </xsl:message>
129                      </xsl:when>
130                      <xsl:otherwise>
131                         <xsl:copy-of select="." />
132                         <xsl:value-of select="$newline" />
133                      </xsl:otherwise>
134                   </xsl:choose>
135                </xsl:for-each>
136
137                <xsl:for-each select="./jconf:cluster_node">
138                   <xsl:copy-of select="." />
139                </xsl:for-each>
140
141                <xsl:element name="use_software_swap_lock">
142                   <xsl:choose>
143                      <xsl:when test="count(../jconf:swap_lock_tcp_plugin) &gt; 0">
144                         <xsl:text>true</xsl:text>
145                      </xsl:when>
146                      <xsl:when test="count(../jconf:swap_lock_wired_plugin) &gt; 0">
147                         <xsl:text>true</xsl:text>
148                      </xsl:when>
149                      <xsl:otherwise>
150                         <xsl:text>false</xsl:text>
151                      </xsl:otherwise>
152                   </xsl:choose>
153                </xsl:element>
154                <xsl:value-of select="$newline" />
155             </xsl:element>
156          </xsl:when>
157          <xsl:otherwise>
158             <xsl:copy-of select="."/>
159          </xsl:otherwise>
160       </xsl:choose>
161    </xsl:template>
162
163    <!-- Remove config elements for defunct plug-ins. -->
164    <xsl:template match="jconf:start_barrier_plugin">
165       <xsl:message>
166          <xsl:text>Removing start_barrier_plugin element.</xsl:text>
167       </xsl:message>
168    </xsl:template>
169
170    <xsl:template match="jconf:swap_lock_tcp_plugin">
171       <xsl:message>
172          <xsl:text>Removing swap_lock_tcp_plugin element.</xsl:text>
173       </xsl:message>
174    </xsl:template>
175
176    <xsl:template match="jconf:swap_lock_wired_plugin">
177       <xsl:message>
178          <xsl:text>Removing swap_lock_wired_plugin element.</xsl:text>
179       </xsl:message>
180    </xsl:template>
181
182    <xsl:template match="jconf:application_data">
183       <xsl:message>
184          <xsl:text>Removing application_data element.</xsl:text>
185       </xsl:message>
186    </xsl:template>
187
188    <xsl:template match="jconf:device_host" />
189
190 <!-- EVERYTHING ELSE ======================================================= -->
191    <!--
192       Copy everything that hasn't already been matched.
193    -->
194    <xsl:template match="*">
195       <xsl:choose>
196          <!--
197             When a node has a jconf:device_host child, we copy its attributes
198             and proceed with a recursive template application. The template
199             above that matches jconf:device_host takes care of deleting it.
200          -->
201          <xsl:when test="count(./jconf:device_host) &gt; 0">
202             <xsl:message>
203                <xsl:text>Removing device_host property from </xsl:text>
204                <xsl:value-of select="@name" />
205             </xsl:message>
206             <xsl:element name="{name()}">
207                <xsl:copy-of select="./@*" />
208                <xsl:apply-templates />
209             </xsl:element>
210          </xsl:when>
211          <xsl:otherwise>
212             <xsl:copy-of select="." />
213          </xsl:otherwise>
214       </xsl:choose>
215    </xsl:template>
216 </xsl:stylesheet>
Note: See TracBrowser for help on using the browser.