1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 |
|
---|
3 | <xsl:stylesheet version="1.0"
|
---|
4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
5 | xmlns:gslib="http://www.greenstone.org/XSL/Library"
|
---|
6 | xmlns:xalan="http://xml.apache.org/xalan"
|
---|
7 | xmlns="http://www.w3.org/1999/xhtml">
|
---|
8 |
|
---|
9 |
|
---|
10 | <xsl:output
|
---|
11 | method="xml"
|
---|
12 | encoding="UTF-8"
|
---|
13 | doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
|
---|
14 | doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
|
---|
15 | omit-xml-declaration="yes"
|
---|
16 | indent="yes"/>
|
---|
17 |
|
---|
18 | <!-- general ............................................................................. -->
|
---|
19 |
|
---|
20 | <xsl:variable name="librarian"></xsl:variable>
|
---|
21 |
|
---|
22 | <xsl:variable name="action" select="/page/pageRequest/@action"/>
|
---|
23 |
|
---|
24 | <xsl:variable name="subaction" select="/page/pageRequest/@subaction"/>
|
---|
25 |
|
---|
26 | <xsl:variable name="lang" select="/page/pageRequest/@lang"/>
|
---|
27 |
|
---|
28 | <xsl:variable name="css">
|
---|
29 | <xsl:for-each select="/page/pageResponse/cssFileList/cssFile">
|
---|
30 | <link rel="stylesheet" href="{@path}" type="text/css" />
|
---|
31 | </xsl:for-each>
|
---|
32 | </xsl:variable>
|
---|
33 |
|
---|
34 | <xsl:variable name="js">
|
---|
35 | <xsl:for-each select="/page/pageResponse/jsFileList/jsFile">
|
---|
36 | <script type="text/javascript" src="{@path}"></script>
|
---|
37 | </xsl:for-each>
|
---|
38 | </xsl:variable>
|
---|
39 |
|
---|
40 | <xsl:template name="metadataItem">
|
---|
41 | <xsl:param name="name"/>
|
---|
42 |
|
---|
43 | <xsl:variable name="x" select="/page/pageResponse/metadataList/metadataItem[@name=$name]" />
|
---|
44 |
|
---|
45 | <xsl:choose>
|
---|
46 | <xsl:when test="$x = ''">
|
---|
47 | metadataItem '<xsl:value-of select="$name"/>' not defined.
|
---|
48 | </xsl:when>
|
---|
49 | <xsl:otherwise>
|
---|
50 | <xsl:for-each select="$x">
|
---|
51 | <xsl:call-template name="expandMetadataAndUiItems" />
|
---|
52 | </xsl:for-each>
|
---|
53 | </xsl:otherwise>
|
---|
54 | </xsl:choose>
|
---|
55 |
|
---|
56 | </xsl:template>
|
---|
57 |
|
---|
58 | <!-- get the uiItem for the given name -->
|
---|
59 | <xsl:template name="uiItem">
|
---|
60 | <xsl:param name="name"/>
|
---|
61 |
|
---|
62 | <xsl:variable name="x" select="/page/pageResponse/uiItemList/uiItem[@name=$name]" />
|
---|
63 |
|
---|
64 | <xsl:choose>
|
---|
65 | <xsl:when test="$x = ''">
|
---|
66 | uiItem '<xsl:value-of select="$name"/>' not defined.
|
---|
67 | </xsl:when>
|
---|
68 | <xsl:otherwise>
|
---|
69 | <xsl:for-each select="$x">
|
---|
70 | <xsl:call-template name="expandMetadataAndUiItems" />
|
---|
71 | </xsl:for-each>
|
---|
72 | </xsl:otherwise>
|
---|
73 | </xsl:choose>
|
---|
74 |
|
---|
75 | </xsl:template>
|
---|
76 |
|
---|
77 | <!-- site level stuff ....................................................................... -->
|
---|
78 |
|
---|
79 | <xsl:variable name="collectionNames" select="/page/pageResponse/collectionList/collection/@name"/>
|
---|
80 |
|
---|
81 | <xsl:template name="collection_title">
|
---|
82 | <xsl:param name="name"/>
|
---|
83 | <xsl:value-of select="/page/pageResponse/collectionList/collection[@name=$name]/displayItem[@name='name']"/>
|
---|
84 | </xsl:template>
|
---|
85 |
|
---|
86 | <xsl:template name="collection_description">
|
---|
87 | <xsl:param name="name"/>
|
---|
88 | <xsl:value-of select="/page/pageResponse/collectionList/collection[@name=$name]/displayItem[@name='description']"/>
|
---|
89 | </xsl:template>
|
---|
90 |
|
---|
91 | <xsl:template name="collection_url">
|
---|
92 | <xsl:param name="name"/>
|
---|
93 | <xsl:value-of select="$librarian" />
|
---|
94 | ?a=p&sa=about&c=
|
---|
95 | <xsl:value-of select="$name" />
|
---|
96 | </xsl:template>
|
---|
97 |
|
---|
98 | <xsl:variable name="site_homeUrl">
|
---|
99 | <xsl:value-of select="$librarian" />
|
---|
100 | ?a=p&sa=home
|
---|
101 | </xsl:variable>
|
---|
102 |
|
---|
103 | <!-- collection level stuff ....................................................................... -->
|
---|
104 |
|
---|
105 | <xsl:variable name="collection" select="/page/pageResponse/collection/@name"/>
|
---|
106 |
|
---|
107 | <xsl:variable name="serviceNames" select="/page/pageResponse/collection/serviceList/service[@type='query' or @type='browse']/@name"/>
|
---|
108 |
|
---|
109 | <xsl:template name="service_title">
|
---|
110 | <xsl:param name="serviceName"/>
|
---|
111 | <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]/displayItem[@name='name']"/>
|
---|
112 | </xsl:template>
|
---|
113 |
|
---|
114 | <xsl:template name="service_description">
|
---|
115 | <xsl:param name="serviceName"/>
|
---|
116 | <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]/displayItem[@name='description']"/>
|
---|
117 | </xsl:template>
|
---|
118 |
|
---|
119 | <xsl:template name="service_url">
|
---|
120 | <xsl:param name="serviceName"/>
|
---|
121 |
|
---|
122 |
|
---|
123 | <xsl:variable name="service" select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]"/>
|
---|
124 | <xsl:variable name="serviceAction">
|
---|
125 | <xsl:choose>
|
---|
126 | <!-- this hard coding doesnt seem like a good idea: why isnt the appropriate action given as an attribute of the service? -->
|
---|
127 | <xsl:when test="$service/@type='query'">q</xsl:when>
|
---|
128 | <xsl:when test="$service/@type='browse'">b</xsl:when>
|
---|
129 | <xsl:when test="$service/@type='process'">pr</xsl:when>
|
---|
130 | <xsl:when test="$service/@type='applet'">a</xsl:when>
|
---|
131 | <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
|
---|
132 | </xsl:choose>
|
---|
133 | </xsl:variable>
|
---|
134 |
|
---|
135 | <xsl:value-of select="$librarian"/>?
|
---|
136 | a=<xsl:value-of select="$serviceAction"/>&rt=d&
|
---|
137 | s=<xsl:value-of select="$serviceName"/>&
|
---|
138 | c=<xsl:value-of select="$collection"/>
|
---|
139 | </xsl:template>
|
---|
140 |
|
---|
141 | <xsl:variable name="classifierNames" select="/page/pageResponse/collection/serviceList//classifier/@name"/>
|
---|
142 |
|
---|
143 | <xsl:template name="classifier_title">
|
---|
144 | <xsl:param name="clsName"/>
|
---|
145 | <xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/displayItem[@name='name']"/>
|
---|
146 | </xsl:template>
|
---|
147 |
|
---|
148 | <xsl:template name="classifier_description">
|
---|
149 | <xsl:param name="clsName"/>
|
---|
150 | <xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/displayItem[@name='description']"/>
|
---|
151 | </xsl:template>
|
---|
152 |
|
---|
153 | <xsl:template name="classifier_url">
|
---|
154 | <xsl:param name="clsName"/>
|
---|
155 | <xsl:value-of select="$librarian"/>?a=b&rt=r&
|
---|
156 | s=<xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/../../@name"/>&
|
---|
157 | c=<xsl:value-of select="$collection"/>&
|
---|
158 | cl=<xsl:value-of select="$clsName"/>
|
---|
159 | </xsl:template>
|
---|
160 |
|
---|
161 |
|
---|
162 | <!-- searching ............................................................................. -->
|
---|
163 |
|
---|
164 | <xsl:template name="hidden_search_params">
|
---|
165 | <input name="c" value="{$collection}" type="hidden"/>
|
---|
166 | <input name="a" value="q" type="hidden"/>
|
---|
167 | <input name="s" value="TextQuery" type="hidden"/>
|
---|
168 | </xsl:template>
|
---|
169 |
|
---|
170 | <xsl:template name="search_param_li">
|
---|
171 | <xsl:param name="search_param"/>
|
---|
172 | <li>
|
---|
173 | <xsl:for-each select="$search_param/displayItem[@name='name']">
|
---|
174 | <xsl:value-of select="." />
|
---|
175 | </xsl:for-each>
|
---|
176 |
|
---|
177 | <xsl:choose>
|
---|
178 |
|
---|
179 | <xsl:when test="$search_param/@type='boolean' or $search_param/@type='enum_single'">
|
---|
180 | <select name="s1.{$search_param/@name}">
|
---|
181 | <xsl:for-each select="$search_param/option">
|
---|
182 | <option name="{@name}">
|
---|
183 | <xsl:for-each select="./displayItem[@name='name']">
|
---|
184 | <xsl:value-of select="." />
|
---|
185 | </xsl:for-each>
|
---|
186 | </option>
|
---|
187 | </xsl:for-each>
|
---|
188 | </select>
|
---|
189 | </xsl:when>
|
---|
190 |
|
---|
191 |
|
---|
192 | <xsl:when test="$search_param/@type='integer'">
|
---|
193 | <input name="s1.{$search_param/@name}" value="{$search_param/@default}"/>
|
---|
194 | </xsl:when>
|
---|
195 |
|
---|
196 | <xsl:when test="$search_param/@type='invisible'">
|
---|
197 | <input name="s1.{$search_param/@name}" value="{$search_param/@default}" type="hidden"/>
|
---|
198 | </xsl:when>
|
---|
199 |
|
---|
200 | </xsl:choose>
|
---|
201 | </li>
|
---|
202 |
|
---|
203 | </xsl:template>
|
---|
204 |
|
---|
205 |
|
---|
206 |
|
---|
207 |
|
---|
208 |
|
---|
209 |
|
---|
210 |
|
---|
211 |
|
---|
212 |
|
---|
213 |
|
---|
214 |
|
---|
215 |
|
---|
216 |
|
---|
217 |
|
---|
218 |
|
---|
219 |
|
---|
220 |
|
---|
221 | <!-- browsing ............................................................................. -->
|
---|
222 |
|
---|
223 | <xsl:variable name="currentClassifierName" select="/page/pageResponse/classifier/@name" />
|
---|
224 |
|
---|
225 | <xsl:variable name="topLevelClassifierNodes" select="/page/pageResponse/classifier/classifierNode"/>
|
---|
226 |
|
---|
227 |
|
---|
228 | <xsl:variable name="topLevelClassifierNodeIds" select="/page/pageResponse/classifier/classifierNode/@nodeID"/>
|
---|
229 |
|
---|
230 | <!--
|
---|
231 | <xsl:template name="classifierNode_title">
|
---|
232 | <xsl:param name="id"/>
|
---|
233 | <xsl:value-of select="/page/pageResponse/classifier//classifierNode[@nodeID=$id]/metadataList/metadata[@name='Title']"/>
|
---|
234 | </xsl:template>
|
---|
235 | -->
|
---|
236 |
|
---|
237 | <xsl:template name="classifierNode_url">
|
---|
238 | <xsl:param name="id"/>
|
---|
239 |
|
---|
240 | <xsl:value-of select="$librarian"/>?a=b&rt=r&
|
---|
241 | s=<xsl:value-of select="/page/pageResponse/service/@name"/>&
|
---|
242 | c=<xsl:value-of select="$collection"/>&
|
---|
243 | cl=<xsl:value-of select="$id" /><xsl:if test="classifierNode|documentNode">.pr</xsl:if>
|
---|
244 |
|
---|
245 | </xsl:template>
|
---|
246 |
|
---|
247 | <xsl:template name="classifierNode_childNodeIds">
|
---|
248 | <xsl:param name="id"/>
|
---|
249 | <xsl:value-of select="xalan:nodeset(/page/pageResponse/classifier//classifierNode[@nodeID=$id])/classifierNode/@nodeID"/>
|
---|
250 | </xsl:template>
|
---|
251 |
|
---|
252 |
|
---|
253 |
|
---|
254 |
|
---|
255 |
|
---|
256 | <xsl:template name="list_classifer_data">
|
---|
257 | <ul>
|
---|
258 | <xsl:for-each select="/page/pageResponse/classifier/classifierNode">
|
---|
259 | <xsl:call-template name="expand_classifier_node" />
|
---|
260 | </xsl:for-each>
|
---|
261 | <xsl:for-each select="/page/pageResponse/classifier/documentNode">
|
---|
262 | <li class="leafNode">
|
---|
263 | <!-- call format statement for docuement node -->
|
---|
264 | <xsl:call-template name="documentNode" />
|
---|
265 | </li>
|
---|
266 | </xsl:for-each>
|
---|
267 | </ul>
|
---|
268 | </xsl:template>
|
---|
269 |
|
---|
270 | <xsl:template name="expand_classifier_node">
|
---|
271 | <xsl:choose>
|
---|
272 |
|
---|
273 | <xsl:when test="classifierNode or documentNode">
|
---|
274 | <!-- if there are children -->
|
---|
275 | <li class="expandedNode">
|
---|
276 | <!-- call format statement for classifier node -->
|
---|
277 | <xsl:call-template name="classifierNode" />
|
---|
278 |
|
---|
279 | <xsl:if test="classifierNode">
|
---|
280 | <ul>
|
---|
281 | <xsl:for-each select="classifierNode">
|
---|
282 | <xsl:call-template name="expand_classifier_node"/>
|
---|
283 | </xsl:for-each>
|
---|
284 | </ul>
|
---|
285 | </xsl:if>
|
---|
286 | <xsl:if test="documentNode">
|
---|
287 | <ul>
|
---|
288 | <xsl:for-each select="documentNode">
|
---|
289 | <li class="leafNode">
|
---|
290 | <!-- call format statement for docuement node -->
|
---|
291 | <xsl:call-template name="documentNode" />
|
---|
292 | </li>
|
---|
293 | </xsl:for-each>
|
---|
294 | </ul>
|
---|
295 | </xsl:if>
|
---|
296 | </li>
|
---|
297 | </xsl:when>
|
---|
298 | <xsl:otherwise>
|
---|
299 | <li class="collapsedNode">
|
---|
300 | <!-- call format statement for classifier node -->
|
---|
301 | <xsl:call-template name="classifierNode" />
|
---|
302 | </li>
|
---|
303 | </xsl:otherwise>
|
---|
304 | </xsl:choose>
|
---|
305 | </xsl:template>
|
---|
306 |
|
---|
307 | <!-- document viewing..................................................................... -->
|
---|
308 |
|
---|
309 | <xsl:variable name="document_coverImage_exists" select="/page/pageResponse/document/@hasCoverImage" />
|
---|
310 |
|
---|
311 | <xsl:variable name="document_coverImage_url">
|
---|
312 | <xsl:if test="$document_coverImage_exists">
|
---|
313 | <xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="normalize-space(/page/pageResponse/document/metadataList/metadata[@name='archivedir'])"/>/cover.jpg
|
---|
314 | </xsl:if>
|
---|
315 | </xsl:variable>
|
---|
316 |
|
---|
317 | <xsl:variable name="document_type" select="/page/pageResponse/document/@docType"/>
|
---|
318 |
|
---|
319 | <xsl:variable name="document_hash" select="/page/pageResponse/document/documentNode/@nodeID" />
|
---|
320 |
|
---|
321 | <xsl:variable name="document_is_expanded" select="/page/pageRequest/paramList/param[@name='ed']/@value=1"/>
|
---|
322 |
|
---|
323 | <xsl:variable name="document_expanded_url">
|
---|
324 | <xsl:value-of select="$librarian"/>?a=d&
|
---|
325 | c=<xsl:value-of select="$collection"/>&
|
---|
326 | d=<xsl:value-of select="$document_hash"/>&
|
---|
327 | ed=1
|
---|
328 | </xsl:variable>
|
---|
329 |
|
---|
330 | <xsl:variable name="document_collapsed_url">
|
---|
331 | <xsl:value-of select="$librarian"/>?a=d&
|
---|
332 | c=<xsl:value-of select="$collection"/>&
|
---|
333 | d=<xsl:value-of select="$document_hash"/>
|
---|
334 | </xsl:variable>
|
---|
335 |
|
---|
336 | <xsl:variable name="document_title" >
|
---|
337 | <xsl:choose>
|
---|
338 | <xsl:when test="$document_type='simple'">
|
---|
339 | <xsl:value-of disable-output-escaping='yes' select="/page/pageResponse/document/metadataList/metadata[@name='Title']" />
|
---|
340 | </xsl:when>
|
---|
341 | <xsl:otherwise>
|
---|
342 | <xsl:value-of disable-output-escaping='yes' select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
|
---|
343 | </xsl:otherwise>
|
---|
344 | </xsl:choose>
|
---|
345 | </xsl:variable>
|
---|
346 |
|
---|
347 | <xsl:variable name="document_content" >
|
---|
348 | <xsl:choose>
|
---|
349 | <xsl:when test="$document_type='simple'">
|
---|
350 | <xsl:value-of select="$document_currentSection_content" />
|
---|
351 | </xsl:when>
|
---|
352 | </xsl:choose>
|
---|
353 | </xsl:variable>
|
---|
354 |
|
---|
355 | <xsl:variable name="document_allSectionIds" select="/page/pageResponse/document//documentNode[@nodeType!='root']" />
|
---|
356 |
|
---|
357 | <xsl:variable name="document_topLevelSectionIds" select="/page/pageResponse/document/documentNode/documentNode" />
|
---|
358 |
|
---|
359 | <xsl:template name="document_section_title">
|
---|
360 | <xsl:param name="sectionId" />
|
---|
361 | <xsl:value-of disable-output-escaping='yes' select="//page/pageResponse/document//documentNode[@nodeID=$sectionId]/metadataList/metadata[@name='Title']"/>
|
---|
362 | </xsl:template>
|
---|
363 |
|
---|
364 | <!--
|
---|
365 | <xsl:template name="document_section_depth">
|
---|
366 | <xsl:param name="index" />
|
---|
367 | <xsl:value-of select="count($document_allSections[$index]/ancestor::documentNode)"/>
|
---|
368 | </xsl:template>
|
---|
369 |
|
---|
370 | <xsl:template name="document_section_content">
|
---|
371 | <xsl:param name="index" />
|
---|
372 | <xsl:value-of disable-output-escaping='yes' select="$document_allSections[$index]/nodeContent"/>
|
---|
373 | </xsl:template>
|
---|
374 |
|
---|
375 | -->
|
---|
376 |
|
---|
377 | <xsl:variable name="document_currentSection" select="/page/pageResponse/document//nodeContent/.." />
|
---|
378 |
|
---|
379 | <xsl:variable name="document_currentSection_title" select="$document_currentSection/metadataList/metadata[@name='Title']" />
|
---|
380 |
|
---|
381 | <xsl:variable name="document_currentSection_content" select="$document_currentSection/nodeContent" />
|
---|
382 |
|
---|
383 | <xsl:variable name="document_previousSection" select="$document_currentSection/preceding::documentNode[@nodeType='leaf'][1]"/>
|
---|
384 |
|
---|
385 | <xsl:variable name="document_previousSection_title" select="$document_previousSection/metadataList/metadata[@name='Title']"/>
|
---|
386 |
|
---|
387 | <xsl:variable name="document_previousSection_url">
|
---|
388 | <xsl:value-of select="$librarian"/>?a=d&
|
---|
389 | c=<xsl:value-of select="$collection"/>&
|
---|
390 | d=<xsl:value-of select="$document_previousSection/@nodeID"/>&
|
---|
391 | sib=1&ec=1
|
---|
392 | </xsl:variable>
|
---|
393 |
|
---|
394 | <xsl:variable name="document_nextSection" select="$document_currentSection/following::documentNode[@nodeType='leaf'][1]"/>
|
---|
395 |
|
---|
396 | <xsl:variable name="document_nextSection_title" select="$document_nextSection/metadataList/metadata[@name='Title']"/>
|
---|
397 |
|
---|
398 | <xsl:variable name="document_nextSection_url">
|
---|
399 | <xsl:value-of select="$librarian"/>?a=d&
|
---|
400 | c=<xsl:value-of select="$collection"/>&
|
---|
401 | d=<xsl:value-of select="$document_nextSection/@nodeID"/>&
|
---|
402 | sib=1&ec=1
|
---|
403 | </xsl:variable>
|
---|
404 |
|
---|
405 | <xsl:variable name="document_ancestorSections" select="$document_currentSection/ancestor::documentNode[@nodeType='internal']"/>
|
---|
406 | <xsl:variable name="document_ancestorSections_titles" select="$document_ancestorSections/metadataList/metadata[@name='Title']"/>
|
---|
407 |
|
---|
408 | <xsl:template name="list_document_content">
|
---|
409 | <ul>
|
---|
410 | <xsl:for-each select="/page/pageResponse/document/documentNode/documentNode">
|
---|
411 | <xsl:call-template name="expand_doc_content_node" />
|
---|
412 | </xsl:for-each>
|
---|
413 | </ul>
|
---|
414 | </xsl:template>
|
---|
415 |
|
---|
416 | <xsl:template name="expand_doc_content_node">
|
---|
417 | <xsl:variable name="class">
|
---|
418 | <xsl:choose>
|
---|
419 | <xsl:when test="@nodeType='leaf'">leaf</xsl:when>
|
---|
420 | <xsl:otherwise>collapsed</xsl:otherwise>
|
---|
421 | </xsl:choose>
|
---|
422 | </xsl:variable>
|
---|
423 |
|
---|
424 | <li class="{$class}" id="{@nodeID}" >
|
---|
425 | <xsl:choose>
|
---|
426 | <xsl:when test="nodeContent">
|
---|
427 | <span id="currentSection">
|
---|
428 | <xsl:value-of disable-output-escaping='yes' select="metadataList/metadata[@name='Title']"/>
|
---|
429 | </span>
|
---|
430 | </xsl:when>
|
---|
431 | <xsl:when test="@nodeType='leaf'">
|
---|
432 | <a href="{$librarian}?a=d&c={$collection}&d={@nodeID}&sib=1&ec=1">
|
---|
433 | <xsl:value-of disable-output-escaping='yes' select="metadataList/metadata[@name='Title']"/>
|
---|
434 | </a>
|
---|
435 | </xsl:when>
|
---|
436 | <xsl:otherwise>
|
---|
437 | <a onclick="toggleNode('{@nodeID}')">
|
---|
438 | <xsl:value-of disable-output-escaping='yes' select="metadataList/metadata[@name='Title']"/>
|
---|
439 | </a>
|
---|
440 | </xsl:otherwise>
|
---|
441 | </xsl:choose>
|
---|
442 |
|
---|
443 | <xsl:if test="documentNode">
|
---|
444 | <ul>
|
---|
445 | <xsl:for-each select="documentNode">
|
---|
446 | <xsl:call-template name="expand_doc_content_node" />
|
---|
447 | </xsl:for-each>
|
---|
448 | </ul>
|
---|
449 | </xsl:if>
|
---|
450 | </li>
|
---|
451 | </xsl:template>
|
---|
452 |
|
---|
453 |
|
---|
454 |
|
---|
455 |
|
---|
456 |
|
---|
457 |
|
---|
458 |
|
---|
459 |
|
---|
460 |
|
---|
461 |
|
---|
462 |
|
---|
463 |
|
---|
464 |
|
---|
465 |
|
---|
466 |
|
---|
467 | <!-- stuff that no-one should need to know about........................................ -->
|
---|
468 |
|
---|
469 | <!-- produce an exact copy of the current node, but expand and replace all metadataItems and uiItems found within. -->
|
---|
470 | <xsl:template name="expandMetadataAndUiItems">
|
---|
471 | <xsl:for-each select="*|text()">
|
---|
472 | <xsl:choose>
|
---|
473 |
|
---|
474 | <!-- if node is a metadataItem, expand it -->
|
---|
475 | <xsl:when test="self::node()[self::metadataItem]">
|
---|
476 | <xsl:call-template name="metadataItem">
|
---|
477 | <xsl:with-param name="name"><xsl:value-of select="@name"/></xsl:with-param>
|
---|
478 | </xsl:call-template>
|
---|
479 | </xsl:when>
|
---|
480 |
|
---|
481 | <!-- if node is a uiItem, expand it -->
|
---|
482 | <xsl:when test="self::node()[self::uiItem]">
|
---|
483 | <xsl:call-template name="uiItem">
|
---|
484 | <xsl:with-param name="name"><xsl:value-of select="@name"/></xsl:with-param>
|
---|
485 | </xsl:call-template>
|
---|
486 | </xsl:when>
|
---|
487 |
|
---|
488 | <xsl:when test="self::text()">
|
---|
489 | <xsl:value-of select="."/>
|
---|
490 | </xsl:when>
|
---|
491 |
|
---|
492 | <!-- if a regular node -->
|
---|
493 | <xsl:otherwise>
|
---|
494 | <xsl:variable name="element-name" select="name()"/>
|
---|
495 | <xsl:element name="{$element-name}">
|
---|
496 | <xsl:for-each select="@*">
|
---|
497 | <xsl:variable name="attribute-name" select="name()"/>
|
---|
498 | <xsl:attribute name="{$attribute-name}">
|
---|
499 | <xsl:call-template name="attribute-filter"/>
|
---|
500 | </xsl:attribute>
|
---|
501 | </xsl:for-each>
|
---|
502 | <xsl:call-template name="expandMetadataAndUiItems" />
|
---|
503 | </xsl:element>
|
---|
504 | </xsl:otherwise>
|
---|
505 | </xsl:choose>
|
---|
506 | </xsl:for-each>
|
---|
507 |
|
---|
508 | </xsl:template>
|
---|
509 |
|
---|
510 | <xsl:template name="attribute-filter"><xsl:value-of select="."/></xsl:template>
|
---|
511 |
|
---|
512 | <xsl:template match="gslib:blah">
|
---|
513 | <p> Blah </p>
|
---|
514 | </xsl:template>
|
---|
515 |
|
---|
516 |
|
---|
517 |
|
---|
518 | </xsl:stylesheet>
|
---|
519 |
|
---|
520 |
|
---|