source: main/trunk/greenstone3/web/interfaces/default/transform/config_format.xsl@ 28749

Last change on this file since 28749 was 28749, checked in by davidb, 10 years ago

quick fix to help with assignment of variable/metadata that is a string

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