source: other-projects/tipple-android/i-greenstone-server-files/greenstone/webapps/greenstone3/interfaces/default/transform/config_format.xsl@ 26899

Last change on this file since 26899 was 26899, checked in by davidb, 11 years ago

Tipple reborn after Chris's Summer of Code 2013

  • Property svn:mime-type set to application/xml
File size: 20.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xslt="output.xsl"
5 xmlns:java="http://xml.apache.org/xslt/java"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
8 extension-element-prefixes="java">
9 <xsl:param name="interface_name"/>
10 <xsl:param name="library_name"/>
11 <xsl:param name="site_name"/>
12 <xsl:param name="collName"/>
13
14 <xsl:output method="xml"/>
15 <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl"/>
16
17 <xsl:template match="format">
18 <format>
19 <xsl:apply-templates/>
20 </format>
21 </xsl:template>
22
23 <xsl:template match="gsf:template">
24 <xslt:template>
25 <xsl:copy-of select="@*"/>
26 <xsl:attribute name="priority">2</xsl:attribute>
27 <xsl:if test=".//gsf:link">
28 <xslt:param name="serviceName"/>
29 <xslt:param name="collName"/>
30 </xsl:if>
31 <xsl:apply-templates/>
32 </xslt:template>
33 </xsl:template>
34
35 <xsl:template match="gsf:variable">
36 <xslt:variable>
37 <xsl:copy-of select="@*"/>
38 <xsl:apply-templates/>
39 </xslt:variable>
40 <script type="text/javascript">
41 gs.variables.<xsl:value-of select="@name"/>
42 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
43 <xsl:apply-templates/>
44 <xslt:text disable-output-escaping="yes">";</xslt:text>
45 </script>
46 </xsl:template>
47
48 <xsl:template match="gsf:defaultClassifierNode">
49 <xslt:call-template name="defaultClassifierNode"/>
50 </xsl:template>
51
52
53 <xsl:template match="gsf:script[@src]">
54 <script>
55 <xsl:attribute name='src'>
56 <xsl:value-of select="@src"/>
57 </xsl:attribute>
58 <xslt:attribute name='type'>text/javascript</xslt:attribute>
59 <xslt:comment/>
60 <!-- comment used to ensure script tag is not collapsed -->
61 </script>
62 </xsl:template>
63
64
65 <xsl:template match="gsf:script">
66 <script type="text/javascript">
67 <xslt:text disable-output-escaping="yes">
68 <xsl:apply-templates/>
69 </xslt:text>
70 </script>
71 </xsl:template>
72
73 <xsl:template match="gsf:style[@src]">
74 <link rel="stylesheet" type="text/css">
75 <xsl:attribute name='href'>
76 <xsl:value-of select="@src"/>
77 </xsl:attribute>
78 </link>
79 </xsl:template>
80
81 <xsl:template match="gsf:style">
82 <style type="text/css">
83 <xsl:apply-templates/>
84 </style>
85 </xsl:template>
86
87
88 <xsl:template match="gsf:image">
89 <xslt:variable name="metaName">
90 <xsl:choose>
91 <xsl:when test="@type = 'thumb'">Thumb</xsl:when>
92 <xsl:when test="@type = 'screen'">Screen</xsl:when>
93 <xsl:when test="@type = 'source'">SourceFile</xsl:when>
94 </xsl:choose>
95 </xslt:variable>
96 <xslt:if test="(.//metadataList)[last()]/metadata[@name = $metaName]">
97 <img>
98 <xslt:attribute name='src'>
99 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name = 'httpPath']"/>
100 <xsl:text>/index/assoc/</xsl:text>
101 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name = 'assocfilepath']"/>
102 <xsl:text>/</xsl:text>
103 <xslt:value-of disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name = $metaName]"/>
104 </xslt:attribute>
105 </img>
106 </xslt:if>
107 </xsl:template>
108
109 <xsl:template match="params"></xsl:template>
110
111 <xsl:template match="gsf:link">
112
113 <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
114 <xsl:variable name="opt-title">
115 <xsl:choose>
116 <xsl:when test="@title">
117 <xslt:attribute name="title">
118 <xsl:value-of select="@title"/>
119 </xslt:attribute>
120 </xsl:when>
121 <xsl:when test="@titlekey">
122 <xslt:attribute name="title">
123 <xslt:value-of disable-output-escaping="yes" select="util:getCollectionText($collName, $site_name, /page/@lang, '{@titlekey}')"/>
124 </xslt:attribute>
125 </xsl:when>
126 </xsl:choose>
127 </xsl:variable>
128
129 <xsl:choose>
130 <xsl:when test="@type='query'">
131 <a>
132 <xsl:if test="@target">
133 <xsl:attribute name='target'>
134 <xsl:value-of select='@target'/>
135 </xsl:attribute>
136 </xsl:if>
137
138 <xslt:attribute name='href'>
139 <xslt:value-of select='$library_name'/>
140 <xsl:text>/collection/</xsl:text>
141 <xslt:value-of select='/page/pageResponse/collection/@name'/>
142 <xsl:text>/search/</xsl:text>
143 <xsl:choose>
144 <xsl:when test="@name">
145 <xsl:value-of select="@name"/>
146 </xsl:when>
147 <xsl:otherwise>
148 <xsl:text>TextQuery</xsl:text>
149 </xsl:otherwise>
150 </xsl:choose>
151 <xsl:if test="params">?rt=rd&amp;<xsl:copy-of select="params/node()"/></xsl:if>
152 </xslt:attribute>
153 <xsl:copy-of select="$opt-title"/>
154 <xsl:apply-templates/>
155 </a>
156 </xsl:when>
157 <xsl:when test="@type='classifier'">
158 <a>
159 <xsl:if test="@target">
160 <xsl:attribute name='target'>
161 <xsl:value-of select='@target'/>
162 </xsl:attribute>
163 </xsl:if>
164
165 <xslt:attribute name='href'>
166 <xslt:value-of select='$library_name'/>
167 <xsl:text>/collection/</xsl:text>
168 <xslt:value-of select='/page/pageResponse/collection/@name'/>
169 <xsl:text>/browse/</xsl:text>
170 <xsl:choose>
171 <xsl:when test="@nodeID">
172 <xsl:value-of select="@nodeID"/>
173 </xsl:when>
174 <xsl:otherwise>
175 <xslt:value-of select='util:replace(@nodeID, ".", "/")'/>
176 </xsl:otherwise>
177 </xsl:choose>
178 </xslt:attribute>
179 <xsl:copy-of select="$opt-title"/>
180 <xsl:apply-templates/>
181 </a>
182 </xsl:when>
183 <xsl:when test="@type='source'">
184 <a>
185 <xsl:if test="@target">
186 <xsl:attribute name='target'>
187 <xsl:value-of select='@target'/>
188 </xsl:attribute>
189 </xsl:if>
190
191 <xslt:attribute name='href'>
192 <xslt:value-of
193 disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xslt:value-of
194 disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='assocfilepath']" />/<xslt:value-of
195 disable-output-escaping="yes" select="(.//metadataList)[last()]/metadata[@name='srclinkFile']" />
196 </xslt:attribute>
197 <xsl:copy-of select="$opt-title"/>
198 <xsl:apply-templates/>
199 </a>
200 </xsl:when>
201 <xsl:when test="@type='web'">
202 <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'weblink')]"/>
203 <xsl:apply-templates/>
204 <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, '/weblink')]"/>
205 </xsl:when>
206 <xsl:when test="@type='page'">
207 <a>
208 <xsl:if test="@target">
209 <xsl:attribute name='target'>
210 <xsl:value-of select='@target'/>
211 </xsl:attribute>
212 </xsl:if>
213
214 <xslt:attribute name='href'>
215 <xslt:value-of select='$library_name'/>
216 <xsl:text>/collection/</xsl:text>
217 <xslt:value-of select='/page/pageResponse/collection/@name'/>
218 <xsl:text>/page/</xsl:text>
219 <xsl:value-of select="@page"/>
220 </xslt:attribute>
221 <xsl:copy-of select="$opt-title"/>
222 <xsl:apply-templates/>
223 </a>
224 </xsl:when>
225 <xsl:when test="@type='equivdoc'">
226 <xsl:call-template name="gsf:equivlinkgs3"/>
227 </xsl:when>
228 <xsl:otherwise>
229 <!-- a document link -->
230 <xslt:variable name="bookswitch">
231 <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
232 </xslt:variable>
233 <a>
234 <xsl:if test="@target">
235 <xsl:attribute name='target'>
236 <xsl:value-of select='@target'/>
237 </xsl:attribute>
238 </xsl:if>
239
240 <xsl:copy-of select="$opt-title"/>
241 <xslt:attribute name="href">
242 <xslt:value-of select='$library_name'/>
243 <xsl:text>/collection/</xsl:text>
244 <xslt:value-of select='/page/pageResponse/collection/@name'/>
245 <xsl:text>/document/</xsl:text>
246 <xsl:choose>
247 <xsl:when test="@OID">
248 <xsl:value-of select="@OID"/>
249 </xsl:when>
250 <xsl:when test="@OIDmetadata">
251 <xsl:variable name="OIDmeta" select="@OIDmetadata"/>
252 <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$OIDmeta}']"/>
253 </xsl:when>
254 <xsl:otherwise>
255 <xslt:value-of select='@nodeID'/>
256 </xsl:otherwise>
257 </xsl:choose>
258 <xslt:choose>
259 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
260 <xsl:text>?book=on</xsl:text>
261 </xslt:when>
262 <xslt:otherwise>
263 <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/>
264 </xslt:if>
265 </xslt:otherwise>
266 </xslt:choose>
267 </xslt:attribute>
268 <xsl:apply-templates/>
269 </a>
270 </xsl:otherwise>
271 </xsl:choose>
272 </xsl:template>
273
274 <xsl:template match="gsf:icon">
275 <xsl:choose>
276 <xsl:when test="@type='classifier'">
277 <img style="border:0px">
278 <xsl:attribute name="src">
279 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/>
280 </xsl:attribute>
281 </img>
282 </xsl:when>
283 <xsl:when test="@type='web'">
284 <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'webicon')]"/>
285 </xsl:when>
286 <xsl:when test="@file">
287 <img>
288 <xslt:attribute name='src'>
289 <xsl:choose>
290 <xsl:when test="not(@select) or @select='site'">
291 <xsl:value-of disable-output-escaping="yes" select="concat('interfaces/',$interface_name,'/images/',@file)"/>
292 </xsl:when>
293 <xsl:when test="@select='collection'">
294 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
295 <xsl:value-of disable-output-escaping="yes" select="concat('/images/',@file)"/>
296 </xsl:when>
297 </xsl:choose>
298 </xslt:attribute>
299 </img>
300 </xsl:when>
301 <xsl:when test="not(@type) or @type='document'">
302 <img style="border:0px">
303 <xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/>
304 </xslt:attribute>
305 <xslt:attribute name="src">
306 <xslt:choose>
307 <xslt:when test="@docType='hierarchy' and @nodeType='root'">
308 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
309 </xslt:when>
310 <xslt:otherwise>
311 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/>
312 </xslt:otherwise>
313 </xslt:choose>
314 </xslt:attribute>
315 </img>
316 </xsl:when>
317 </xsl:choose>
318 </xsl:template>
319
320 <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue -->
321 <!--<xsl:template match="gsf:equivlinkgs3">
322 <xslt:call-template name="equivDocLinks">
323 <xslt:with-param name="count" select="0"/>
324 </xslt:call-template>
325 </xsl:template>-->
326
327 <!-- Another way (also works with DSpace tutorial): build all the equivalent document links for the current document in one go. No looping necessary: handled in function call. -->
328 <xsl:template match="gsf:equivlinkgs3" name="gsf:equivlinkgs3">
329 <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
330 <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>
331 <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
332
333 <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" />
334 <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/>
335 </xsl:template>
336
337 <!--
338In the collection's format statement, could have the following javascript+XSLT in place of
339the gsf:equivlinkgs3 element (which resolves to the XSLT in config_format.xsl and gslib.xsl).
340<xsl:text disable-output-escaping="yes">&lt;script&gt;var equivDocIcon= [ &quot;
341</xsl:text>
342<gsf:metadata name="equivDocIcon" separator="&quot;, &quot;" multiple="true"/>
343<xsl:text disable-output-escaping="yes">&quot;];var equivDocStartLink= [ &quot;
344</xsl:text>
345<gsf:metadata name="equivDocLink" separator="&quot;,&quot;" multiple="true"/>
346<xsl:text disable-output-escaping="yes">&quot;];var equivDocEndLink= [ &quot;
347</xsl:text>
348<gsf:metadata name="/equivDocLink" separator="&quot;,&quot;" multiple="true"/>
349<xsl:text disable-output-escaping="yes">&quot;];for (var i=0; i&lt;equivDocIcon.length; i++) { document.write(equivDocStartLink[i]+ equivDocIcon[i] + equivDocEndLink[i]); }&lt;/script&gt;
350</xsl:text>
351-->
352
353 <!-- gsf:cgiparam example, as used by the Enhanced PDF tutorial:
354 <a><xsl:attribute name="href"><gsf:metadata name="httpPath" type="collection"/>/index/assoc/<gsf:metadata name="archivedir"/>/<gsf:metadata name="srclinkFile"/>#search=&amp;quot;<gsf:cgi-param name="query"/>&amp;quot;</xsl:attribute>src doc link with query highlighting</a> -->
355 <xsl:template match="gsf:cgi-param">
356 <xslt:value-of disable-output-escaping="yes" select="/page/pageRequest/paramList/param[@name='s1.{@name}']/@value"/>
357 </xsl:template>
358
359 <!-- A GLI user can use a gsf:displayText element in GS3's Format Features to retrieve
360 a string defined in either collectionConfig.xml or else the interface dictionaries.
361 If the requested string occurs in neither, the request string itself will be output. -->
362 <xsl:template match="gsf:displayText">
363 <xslt:variable name="displaytext">
364 <xsl:call-template name="gsf:displayItem"/>
365 </xslt:variable>
366
367 <xslt:choose>
368 <xslt:when test="$displaytext != ''">
369 <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>
370 </xslt:when>
371 <xslt:otherwise>
372 <xslt:variable name="interfacetxt">
373 <xsl:call-template name="gsf:interfaceText"/>
374 </xslt:variable>
375
376 <xslt:choose>
377 <xslt:when test="$interfacetxt != ''">
378 <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
379 </xslt:when>
380 <xslt:otherwise>
381 <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
382 </xslt:otherwise>
383 </xslt:choose>
384 </xslt:otherwise>
385 </xslt:choose>
386 </xsl:template>
387
388 <!-- With gsf:displayItem, a user can request a displayItem from collectionConfig.xml -->
389 <xsl:template match="gsf:displayItem" name="gsf:displayItem">
390 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
391 </xsl:template>
392
393 <!-- With gsf:interfaceText, a user can request a string from the interface dictionaries in the current lang -->
394 <xsl:template match="gsf:interfaceText" name="gsf:interfaceText">
395 <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
396 </xsl:template>
397 <!-- With gsf:collectionText, a user can request a string from the collection's dictionary in the current lang -->
398 <xsl:template match="gsf:collectionText" name="gsf:collectionText">
399 <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
400 <xslt:copy-of select="util:getCollectionText($collName, $site_name, /page/@lang, '{@name}', '{@args}')/node()"/>
401 </xsl:template>
402
403 <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
404 <xsl:template match="gsf:metadata">
405 <xsl:if test="not(@hidden = 'true')">
406 <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
407 <xsl:variable name="meta_name">
408 <xsl:call-template name="getMetadataName"/>
409 </xsl:variable>
410 <xsl:variable name="separator">
411 <xsl:choose>
412 <xsl:when test="@separator">
413 <xsl:value-of disable-output-escaping='yes' select="@separator"/>
414 </xsl:when>
415 <xsl:when test="separator">
416 <xsl:copy-of select="separator/node()"/>
417 </xsl:when>
418 <xsl:otherwise>
419 <xsl:text>, </xsl:text>
420 </xsl:otherwise>
421 </xsl:choose>
422 </xsl:variable>
423 <xsl:variable name="prefix">
424 <xsl:choose>
425 <xsl:when test="@prefix">
426 <xsl:value-of disable-output-escaping='yes' select="@prefix"/>
427 </xsl:when>
428 <xsl:when test="prefix">
429 <xsl:copy-of select="prefix/node()"/>
430 </xsl:when>
431 </xsl:choose>
432 </xsl:variable>
433 <xsl:variable name="suffix">
434 <xsl:choose>
435 <xsl:when test="@suffix">
436 <xsl:value-of disable-output-escaping='yes' select="@suffix"/>
437 </xsl:when>
438 <xsl:when test="suffix">
439 <xsl:copy-of select="suffix/node()"/>
440 </xsl:when>
441 </xsl:choose>
442 </xsl:variable>
443 <xsl:variable name="postest">
444 <xsl:choose>
445 <xsl:when test="@pos = 'first'">position()=1</xsl:when>
446 <xsl:when test="@pos = 'last'">position() = last()</xsl:when>
447 <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/>
448 </xsl:when>
449 <xsl:otherwise>true()</xsl:otherwise>
450 </xsl:choose>
451 </xsl:variable>
452 <xsl:variable name="multiple">
453 <xsl:choose>
454 <xsl:when test="@pos">false()</xsl:when>
455 <xsl:otherwise>true()</xsl:otherwise>
456 </xsl:choose>
457 </xsl:variable>
458 <xslt:for-each>
459 <xsl:attribute name="select">
460 <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>(.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang">
461 <xsl:text> and @lang=</xsl:text>
462 <xsl:value-of select="@lang"/>
463 </xsl:if>
464 <xsl:text>]</xsl:text>
465 </xsl:attribute>
466 <xslt:if test="{$postest}">
467 <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/>
468 </xslt:if>
469 <xsl:copy-of select="$prefix"/>
470 <xsl:choose>
471 <xsl:when test="@format">
472 <xslt:value-of disable-output-escaping='yes' select="util:{@format}(., /page/@lang )"/>
473 </xsl:when>
474 <xsl:otherwise>
475 <xslt:value-of disable-output-escaping='yes' select="."/>
476 </xsl:otherwise>
477 </xsl:choose>
478 </xslt:if>
479 <xsl:copy-of select="$suffix"/>
480 </xslt:for-each>
481 </xsl:if>
482 </xsl:template>
483
484
485 <xsl:template match="gsf:foreach-metadata">
486 <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
487 <xslt:for-each>
488 <xsl:attribute name="select">
489 <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>(.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang"><xsl:text> and @lang=</xsl:text><xsl:value-of select="@lang"/></xsl:if><xsl:text>]</xsl:text>
490 </xsl:attribute><xsl:if test='@separator'><xslt:if test='position()>1'><xsl:value-of select='@separator'/></xslt:if></xsl:if>
491 <xsl:apply-templates/>
492 </xslt:for-each>
493 </xsl:template>
494
495 <xsl:template match="gsf:meta-value">
496 <xslt:value-of select="."/>
497 </xsl:template>
498
499 <xsl:template name="getMetadataName">
500 <xsl:if test='@select'>
501 <xsl:value-of select='@select'/>
502 <xsl:text>_</xsl:text>
503 </xsl:if>
504 <xsl:value-of select="@name"/>
505 </xsl:template>
506
507
508 <xsl:template match="gsf:text">
509 <xslt:call-template name="documentNodeText"/>
510 </xsl:template>
511
512 <xsl:template match="gsf:if-metadata-exists">
513 <xsl:variable name="meta-path">
514 <xsl:for-each select="gsf:metadata">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:for-each>
515 </xsl:variable>
516 <xslt:choose>
517 <xslt:when test="{$meta-path}">
518 <xsl:apply-templates select="gsf:if/node()"/>
519 </xslt:when>
520 <xsl:if test="gsf:else">
521 <xslt:otherwise>
522 <xsl:apply-templates select="gsf:else/node()"/>
523 </xslt:otherwise>
524 </xsl:if>
525 </xslt:choose>
526 </xsl:template>
527
528 <xsl:template match="gsf:choose-metadata">
529 <xslt:choose>
530 <xsl:for-each select="gsf:metadata">
531 <xslt:when>
532 <xsl:attribute name="test">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:attribute>
533 <xsl:apply-templates select="."/>
534 </xslt:when>
535 </xsl:for-each>
536 <xsl:if test="gsf:default">
537 <xslt:otherwise>
538 <xsl:apply-templates select="gsf:default"/>
539 </xslt:otherwise>
540 </xsl:if>
541 </xslt:choose>
542 </xsl:template>
543
544 <xsl:template match="gsf:switch">
545 <xsl:variable name="meta-name">
546 <xsl:for-each select="gsf:metadata">
547 <xsl:call-template name="getMetadataName"/>
548 </xsl:for-each>
549 </xsl:variable>
550 <xslt:variable name="meta">
551 <xsl:choose>
552 <xsl:when test="@preprocess">
553 <xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'], /page/@lang )"/>
554 </xsl:when>
555 <xsl:otherwise>
556 <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/>
557 </xsl:otherwise>
558 </xsl:choose>
559 </xslt:variable>
560 <xslt:choose>
561 <xsl:for-each select="gsf:when">
562 <xslt:when test="util:{@test}($meta, '{@test-value}')">
563 <xsl:apply-templates/>
564 </xslt:when>
565 </xsl:for-each>
566 <xsl:if test="gsf:otherwise">
567 <xslt:otherwise>
568 <xsl:apply-templates select="gsf:otherwise/node()"/>
569 </xslt:otherwise>
570 </xsl:if>
571 </xslt:choose>
572 </xsl:template>
573
574 <!--
575 <gsf:headMetaTags> exists for controlling the <meta name="x" content="y"> elements that appear in the HTML <head></head>
576 XPATH is used to select this item (in header.xsl). It does not need an explicit definition here in this file
577 -->
578
579 <xsl:template match="*">
580 <xsl:copy>
581 <xsl:copy-of select="@*"/>
582 <xsl:apply-templates/>
583 </xsl:copy>
584 </xsl:template>
585
586</xsl:stylesheet>
587
588
Note: See TracBrowser for help on using the repository browser.