forked from Kitware/ParaView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paraview_servermanager_convert_xml.xsl
260 lines (231 loc) · 8.08 KB
/
paraview_servermanager_convert_xml.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<?xml version="1.0" encoding="utf8"?>
<!-- XSL used to generate XML DOM from ServerManager xmls as well as GUI
configuration xmls for sources/filters/etc.
to run use : xmlpatterns <xsl> <xml> -output <html>
-->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="ServerManagerConfiguration/ProxyGroup">
<xsl:for-each select="CompoundSourceProxy|SourceProxy|Proxy|PWriterProxy|WriterProxy|PSWriterProxy">
<proxy>
<group><xsl:value-of select="../@name" /></group>
<name><xsl:value-of select="@name" /></name>
<label>
<xsl:choose>
<xsl:when test="@label"> <xsl:value-of select="@label" /> </xsl:when>
<xsl:otherwise> <xsl:value-of select="@name" /> </xsl:otherwise>
</xsl:choose>
</label>
<xsl:apply-templates select="Documentation" />
<xsl:for-each select="DoubleVectorProperty|InputProperty|IntVectorProperty|StringVectorProperty|ProxyProperty|IdTypeVectorProperty">
<property>
<name><xsl:value-of select="@name" /></name>
<label>
<xsl:choose>
<xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@name"/></xsl:otherwise>
</xsl:choose>
</label>
<xsl:apply-templates select="Documentation" />
<defaults><xsl:call-template name="WriteDefaults" /> </defaults>
<domains><xsl:call-template name="WriteDomain" /></domains>
</property>
</xsl:for-each>
<xsl:if test="Hints/ReaderFactory">
<xsl:copy-of select="Hints/ReaderFactory" />
</xsl:if>
<xsl:if test="Hints/WriterFactory">
<xsl:copy-of select="Hints/WriterFactory" />
</xsl:if>
</proxy>
</xsl:for-each>
</xsl:template>
<!-- Defaults Handler -->
<xsl:template name="WriteDefaults">
<xsl:if test="@default_values">
<xsl:value-of select="@default_values" />
</xsl:if>
</xsl:template>
<!-- Domains Handler -->
<xsl:template name="WriteDomain">
<xsl:apply-templates select="ArrayListDomain" />
<xsl:apply-templates select="ArrayRangeDomain" />
<xsl:apply-templates select="ArraySelectionDomain" />
<xsl:apply-templates select="BooleanDomain" />
<xsl:apply-templates select="BoundsDomain" />
<xsl:apply-templates select="DataTypeDomain" />
<xsl:apply-templates select="DoubleRangeDomain" />
<xsl:apply-templates select="IntRangeDomain" />
<xsl:apply-templates select="EnumerationDomain" />
<xsl:apply-templates select="ExtentDomain" />
<xsl:apply-templates select="FieldDataDomain" />
<xsl:apply-templates select="FileListDomain" />
<xsl:apply-templates select="FixedTypeDomain" />
<xsl:apply-templates select="InputArrayDomain" />
<xsl:apply-templates select="ProxyGroupDomain" />
<xsl:apply-templates select="ProxyListDomain" />
<xsl:apply-templates select="StringListDomain" />
</xsl:template>
<xsl:template match="StringListDomain">
<domain>
<text>The value(s) can be one of the following:</text>
<list>
<xsl:for-each select="String">
<item><xsl:value-of select="@value"/></item>
</xsl:for-each>
</list>
</domain>
</xsl:template>
<xsl:template match="ProxyListDomain">
<domain>
<text>The value can be one of the following:</text>
<list>
<xsl:for-each select="Proxy">
<item>
<xsl:value-of select="@name"/> (<xsl:value-of select="@group"/>)
</item>
</xsl:for-each>
</list>
</domain>
</xsl:template>
<xsl:template match="ProxyGroupDomain">
<!-- ugh, ignore this domain. It's pretty pointless anyways.-->
</xsl:template>
<xsl:template match="ExtentDomain">
<domain>
<text>The value(s) must lie within the structured-extents of the input dataset.</text>
</domain>
</xsl:template>
<xsl:template match="FieldDataDomain">
<domain>
<text>The value must be field array name.</text>
</domain>
</xsl:template>
<xsl:template match="FileListDomain">
<domain>
<text> The value(s) must be a filename (or filenames).</text>
</domain>
</xsl:template>
<xsl:template match="FixedTypeDomain">
<domain>
<text>Once set, the input dataset cannot be changed.</text>
</domain>
</xsl:template>
<xsl:template match="InputArrayDomain">
<domain>
<text>
The dataset must contain a field array (<xsl:value-of select="@attribute_type"/>)
<xsl:if test="@number_of_components">
with <xsl:value-of select="@number_of_components"/> component(s).
</xsl:if>
</text>
</domain>
</xsl:template>
<xsl:template match="EnumerationDomain">
<domain>
<text>The value(s) is an enumeration of the following:</text>
<list>
<xsl:for-each select="Entry">
<item><xsl:value-of select="@text"/> (<xsl:value-of select="@value"/>)</item>
</xsl:for-each>
</list>
</domain>
</xsl:template>
<xsl:template match="ArrayListDomain[@attribute_type='Scalars']">
<!-- Handle ArrayListDomain -->
<domain><text>An array of scalars is required.</text></domain>
</xsl:template>
<xsl:template match="ArrayListDomain[@attribute_type='Vectors']">
<!-- Handle ArrayListDomain -->
<domain><text>An array of vectors is required.</text></domain>
</xsl:template>
<xsl:template match="ArrayRangeDomain">
<domain><text>The value must lie within the range of the selected data array.</text></domain>
</xsl:template>
<xsl:template match="ArraySelectionDomain">
<domain><text>The list of array names is provided by the reader.</text></domain>
</xsl:template>
<xsl:template match="BoundsDomain[@mode='normal']">
<domain><text>
The value must lie within the bounding box of the dataset.
<xsl:if test="@default_mode">
It will default to the <xsl:value-of select="@default_mode" /> in each dimension.
</xsl:if>
</text></domain>
</xsl:template>
<xsl:template match="BoundsDomain[@mode='magnitude']">
<domain><text>
Determine the length of the dataset's diagonal.
The value must lie within -diagonal length to +diagonal length.
</text></domain>
</xsl:template>
<xsl:template match="BoundsDomain[@mode='scaled_extent']">
<domain><text>
The value must be less than the largest dimension of the
dataset multiplied by a scale factor of
<xsl:value-of select="@scale_factor" />.
</text></domain>
</xsl:template>
<xsl:template match="DoubleRangeDomain">
<xsl:call-template name="RangeDomain"/>
</xsl:template>
<xsl:template match="IntRangeDomain">
<xsl:call-template name="RangeDomain"/>
</xsl:template>
<xsl:template name="RangeDomain">
Value(s) must be in the range (
<xsl:value-of select="@min"/>,
<xsl:value-of select="@max"/>).
</xsl:template>
<xsl:template match="DataTypeDomain">
<domain>
<text>Accepts input of following types:</text>
<list>
<xsl:for-each select="DataType">
<item><xsl:value-of select="@value" /> </item>
</xsl:for-each>
</list>
</domain>
</xsl:template>
<xsl:template match="BooleanDomain">
<domain><text>Accepts boolean values (0 or 1).</text></domain>
</xsl:template>
<!-- Documentation Handler -->
<xsl:template match="Documentation">
<documentation>
<brief>
<xsl:choose>
<xsl:when test="@long_help">
<xsl:value-of select="@long_help" />
</xsl:when>
<xsl:otherwise>
<xsl:if test="@short_help">
<xsl:value-of select="@short_help" />
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</brief>
<long><xsl:value-of select="." /></long>
</documentation>
</xsl:template>
<xsl:template match="ParaViewSources">
<categoryindex>
<label>Sources</label>
<xsl:call-template name="GenerateCategoryIndex" />
</categoryindex>
</xsl:template>
<xsl:template match="ParaViewFilters">
<categoryindex>
<label>Filters</label>
<xsl:call-template name="GenerateCategoryIndex" />
</categoryindex>
</xsl:template>
<xsl:template name="GenerateCategoryIndex" >
<xsl:for-each select="//Proxy">
<xsl:element name="item">
<xsl:attribute name="proxy_name"><xsl:value-of select="@name"/></xsl:attribute>
<xsl:attribute name="proxy_group"><xsl:value-of select="@group"/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>