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

Last change on this file since 27101 was 27101, checked in by ak19, 8 years ago

Final commit for GS3 RSS support: if a GS3 collection is built by activating (uncommenting) its RSSRetrieve ServiceRack in its collectionConfig.xml, then an RSS icon will now be added to the button bar of the collection's pages that links to the collection's RSS feed.

File size: 21.3 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:when test="@type='rss'">
229 <a>
230 <xslt:attribute name='href'>
231 <xslt:value-of select='$library_name'/>
232 <xsl:text>?a=rss&amp;l=en&amp;site=</xsl:text>
233 <xslt:value-of select="$site_name"/>
234 <xsl:text>&amp;c=</xsl:text>
235 <xslt:value-of select='/page/pageResponse/collection/@name'/>
236 </xslt:attribute>
237 <xsl:apply-templates/>
238 </a>
239 </xsl:when>
240 <xsl:otherwise>
241 <!-- a document link -->
242 <xslt:variable name="bookswitch">
243 <xslt:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
244 </xslt:variable>
245 <a>
246 <xsl:if test="@target">
247 <xsl:attribute name='target'>
248 <xsl:value-of select='@target'/>
249 </xsl:attribute>
250 </xsl:if>
251
252 <xsl:copy-of select="$opt-title"/>
253 <xslt:attribute name="href">
254 <xslt:value-of select='$library_name'/>
255 <xsl:text>/collection/</xsl:text>
256 <xslt:value-of select='/page/pageResponse/collection/@name'/>
257 <xsl:text>/document/</xsl:text>
258 <xsl:choose>
259 <xsl:when test="@OID">
260 <xsl:value-of select="@OID"/>
261 </xsl:when>
262 <xsl:when test="@OIDmetadata">
263 <xsl:variable name="OIDmeta" select="@OIDmetadata"/>
264 <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$OIDmeta}']"/>
265 </xsl:when>
266 <xsl:otherwise>
267 <xslt:value-of select='@nodeID'/>
268 </xsl:otherwise>
269 </xsl:choose>
270 <xslt:choose>
271 <xslt:when test="$bookswitch = 'on' or $bookswitch = 'flashxml'">
272 <xsl:text>?book=on</xsl:text>
273 </xslt:when>
274 <xslt:otherwise>
275 <xslt:if test="$opt-doc-link-args">?<xslt:value-of select="$opt-doc-link-args"/>
276 </xslt:if>
277 </xslt:otherwise>
278 </xslt:choose>
279 </xslt:attribute>
280 <xsl:apply-templates/>
281 </a>
282 </xsl:otherwise>
283 </xsl:choose>
284 </xsl:template>
285
286 <xsl:template match="gsf:icon">
287 <xsl:choose>
288 <xsl:when test="@type='classifier'">
289 <img style="border:0px">
290 <xsl:attribute name="src">
291 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/>
292 </xsl:attribute>
293 </img>
294 </xsl:when>
295 <xsl:when test="@type='web'">
296 <xslt:value-of disable-output-escaping="yes" select="metadataList/metadata[contains(@name, 'webicon')]"/>
297 </xsl:when>
298 <xsl:when test="@file">
299 <img>
300 <xslt:attribute name='src'>
301 <xsl:choose>
302 <xsl:when test="not(@select) or @select='site'">
303 <xsl:value-of disable-output-escaping="yes" select="concat('interfaces/',$interface_name,'/images/',@file)"/>
304 </xsl:when>
305 <xsl:when test="@select='collection'">
306 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
307 <xsl:value-of disable-output-escaping="yes" select="concat('/images/',@file)"/>
308 </xsl:when>
309 </xsl:choose>
310 </xslt:attribute>
311 </img>
312 </xsl:when>
313 <xsl:when test="not(@type) or @type='document'">
314 <img style="border:0px">
315 <xslt:attribute name="id">documentBasketBook<xslt:value-of select="/page/pageResponse/collection/@name"/>:<xslt:value-of select="@nodeID"/>
316 </xslt:attribute>
317 <xslt:attribute name="src">
318 <xslt:choose>
319 <xslt:when test="@docType='hierarchy' and @nodeType='root'">
320 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'book_image')"/>
321 </xslt:when>
322 <xslt:otherwise>
323 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_icon_image')"/>
324 </xslt:otherwise>
325 </xslt:choose>
326 </xslt:attribute>
327 </img>
328 </xsl:when>
329 </xsl:choose>
330 </xsl:template>
331
332 <!-- calls a template in gslib.xsl in order to avoid xsl vs xslt issue -->
333 <!--<xsl:template match="gsf:equivlinkgs3">
334 <xslt:call-template name="equivDocLinks">
335 <xslt:with-param name="count" select="0"/>
336 </xslt:call-template>
337 </xsl:template>-->
338
339 <!-- 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. -->
340 <xsl:template match="gsf:equivlinkgs3" name="gsf:equivlinkgs3">
341 <xslt:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
342 <xslt:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>
343 <xslt:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
344
345 <xslt:variable name="equivDocLinks" select="java:org.greenstone.gsdl3.util.XSLTUtil.getEquivDocLinks(',',$docicon, $docStartlink, $docEndlink, ' ')" />
346 <xslt:value-of disable-output-escaping="yes" select="$equivDocLinks"/>
347 </xsl:template>
348
349 <!--
350In the collection's format statement, could have the following javascript+XSLT in place of
351the gsf:equivlinkgs3 element (which resolves to the XSLT in config_format.xsl and gslib.xsl).
352<xsl:text disable-output-escaping="yes">&lt;script&gt;var equivDocIcon= [ &quot;
353</xsl:text>
354<gsf:metadata name="equivDocIcon" separator="&quot;, &quot;" multiple="true"/>
355<xsl:text disable-output-escaping="yes">&quot;];var equivDocStartLink= [ &quot;
356</xsl:text>
357<gsf:metadata name="equivDocLink" separator="&quot;,&quot;" multiple="true"/>
358<xsl:text disable-output-escaping="yes">&quot;];var equivDocEndLink= [ &quot;
359</xsl:text>
360<gsf:metadata name="/equivDocLink" separator="&quot;,&quot;" multiple="true"/>
361<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;
362</xsl:text>
363-->
364
365 <!-- gsf:cgiparam example, as used by the Enhanced PDF tutorial:
366 <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> -->
367 <xsl:template match="gsf:cgi-param">
368 <xslt:value-of disable-output-escaping="yes" select="/page/pageRequest/paramList/param[@name='s1.{@name}']/@value"/>
369 </xsl:template>
370
371 <!-- A GLI user can use a gsf:displayText element in GS3's Format Features to retrieve
372 a string defined in either collectionConfig.xml or else the interface dictionaries.
373 If the requested string occurs in neither, the request string itself will be output. -->
374 <xsl:template match="gsf:displayText">
375 <xslt:variable name="displaytext">
376 <xsl:call-template name="gsf:displayItem"/>
377 </xslt:variable>
378
379 <xslt:choose>
380 <xslt:when test="$displaytext != ''">
381 <xslt:value-of disable-output-escaping="yes" select="$displaytext"/>
382 </xslt:when>
383 <xslt:otherwise>
384 <xslt:variable name="interfacetxt">
385 <xsl:call-template name="gsf:interfaceText"/>
386 </xslt:variable>
387
388 <xslt:choose>
389 <xslt:when test="$interfacetxt != ''">
390 <xslt:value-of disable-output-escaping="yes" select="$interfacetxt"/>
391 </xslt:when>
392 <xslt:otherwise>
393 <xslt:value-of disable-output-escaping="yes" select="'{@name}'"/>
394 </xslt:otherwise>
395 </xslt:choose>
396 </xslt:otherwise>
397 </xslt:choose>
398 </xsl:template>
399
400 <!-- With gsf:displayItem, a user can request a displayItem from collectionConfig.xml -->
401 <xsl:template match="gsf:displayItem" name="gsf:displayItem">
402 <xslt:value-of disable-output-escaping="yes" select="/page/pageResponse/collection/displayItem[@name='{@name}']"/>
403 </xsl:template>
404
405 <!-- With gsf:interfaceText, a user can request a string from the interface dictionaries in the current lang -->
406 <xsl:template match="gsf:interfaceText" name="gsf:interfaceText">
407 <xslt:value-of disable-output-escaping="yes" select="util:getInterfaceText($interface_name, /page/@lang, '{@name}')"/>
408 </xsl:template>
409 <!-- With gsf:collectionText, a user can request a string from the collection's dictionary in the current lang -->
410 <xsl:template match="gsf:collectionText" name="gsf:collectionText">
411 <xslt:variable name="collName" select="/page/pageResponse/collection/@name"/>
412 <xslt:copy-of select="util:getCollectionText($collName, $site_name, /page/@lang, '{@name}', '{@args}')/node()"/>
413 </xsl:template>
414
415 <!-- if this gsf:metadata is a child of a document node then we want to get the metadata for that node -->
416 <xsl:template match="gsf:metadata">
417 <xsl:if test="not(@hidden = 'true')">
418 <!-- set hidden=true on a gsf:metadata so that it gets retrieved from the server but not displayed -->
419 <xsl:variable name="meta_name">
420 <xsl:call-template name="getMetadataName"/>
421 </xsl:variable>
422 <xsl:variable name="separator">
423 <xsl:choose>
424 <xsl:when test="@separator">
425 <xsl:value-of disable-output-escaping='yes' select="@separator"/>
426 </xsl:when>
427 <xsl:when test="separator">
428 <xsl:copy-of select="separator/node()"/>
429 </xsl:when>
430 <xsl:otherwise>
431 <xsl:text>, </xsl:text>
432 </xsl:otherwise>
433 </xsl:choose>
434 </xsl:variable>
435 <xsl:variable name="prefix">
436 <xsl:choose>
437 <xsl:when test="@prefix">
438 <xsl:value-of disable-output-escaping='yes' select="@prefix"/>
439 </xsl:when>
440 <xsl:when test="prefix">
441 <xsl:copy-of select="prefix/node()"/>
442 </xsl:when>
443 </xsl:choose>
444 </xsl:variable>
445 <xsl:variable name="suffix">
446 <xsl:choose>
447 <xsl:when test="@suffix">
448 <xsl:value-of disable-output-escaping='yes' select="@suffix"/>
449 </xsl:when>
450 <xsl:when test="suffix">
451 <xsl:copy-of select="suffix/node()"/>
452 </xsl:when>
453 </xsl:choose>
454 </xsl:variable>
455 <xsl:variable name="postest">
456 <xsl:choose>
457 <xsl:when test="@pos = 'first'">position()=1</xsl:when>
458 <xsl:when test="@pos = 'last'">position() = last()</xsl:when>
459 <xsl:when test="@pos">position() = <xsl:value-of select="@pos"/>
460 </xsl:when>
461 <xsl:otherwise>true()</xsl:otherwise>
462 </xsl:choose>
463 </xsl:variable>
464 <xsl:variable name="multiple">
465 <xsl:choose>
466 <xsl:when test="@pos">false()</xsl:when>
467 <xsl:otherwise>true()</xsl:otherwise>
468 </xsl:choose>
469 </xsl:variable>
470 <xslt:for-each>
471 <xsl:attribute name="select">
472 <xsl:if test="@type='collection'">/page/pageResponse/collection/</xsl:if>(.//metadataList)[last()]/metadata[@name='<xsl:value-of select="$meta_name"/>'<xsl:if test="@lang">
473 <xsl:text> and @lang=</xsl:text>
474 <xsl:value-of select="@lang"/>
475 </xsl:if>
476 <xsl:text>]</xsl:text>
477 </xsl:attribute>
478 <xslt:if test="{$postest}">
479 <xslt:if test="{$multiple} and position()>1"><xsl:copy-of select="$separator"/>
480 </xslt:if>
481 <xsl:copy-of select="$prefix"/>
482 <xsl:choose>
483 <xsl:when test="@format">
484 <xslt:value-of disable-output-escaping='yes' select="util:{@format}(., /page/@lang )"/>
485 </xsl:when>
486 <xsl:otherwise>
487 <xslt:value-of disable-output-escaping='yes' select="."/>
488 </xsl:otherwise>
489 </xsl:choose>
490 </xslt:if>
491 <xsl:copy-of select="$suffix"/>
492 </xslt:for-each>
493 </xsl:if>
494 </xsl:template>
495
496
497 <xsl:template match="gsf:foreach-metadata">
498 <xsl:variable name="meta_name"><xsl:call-template name="getMetadataName"/></xsl:variable>
499 <xslt:for-each>
500 <xsl:attribute name="select">
501 <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>
502 </xsl:attribute><xsl:if test='@separator'><xslt:if test='position()>1'><xsl:value-of select='@separator'/></xslt:if></xsl:if>
503 <xsl:apply-templates/>
504 </xslt:for-each>
505 </xsl:template>
506
507 <xsl:template match="gsf:meta-value">
508 <xslt:value-of select="."/>
509 </xsl:template>
510
511 <xsl:template name="getMetadataName">
512 <xsl:if test='@select'>
513 <xsl:value-of select='@select'/>
514 <xsl:text>_</xsl:text>
515 </xsl:if>
516 <xsl:value-of select="@name"/>
517 </xsl:template>
518
519
520 <xsl:template match="gsf:text">
521 <xslt:call-template name="documentNodeText"/>
522 </xsl:template>
523
524 <xsl:template match="gsf:if-metadata-exists">
525 <xsl:variable name="meta-path">
526 <xsl:for-each select="gsf:metadata">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:for-each>
527 </xsl:variable>
528 <xslt:choose>
529 <xslt:when test="{$meta-path}">
530 <xsl:apply-templates select="gsf:if/node()"/>
531 </xslt:when>
532 <xsl:if test="gsf:else">
533 <xslt:otherwise>
534 <xsl:apply-templates select="gsf:else/node()"/>
535 </xslt:otherwise>
536 </xsl:if>
537 </xslt:choose>
538 </xsl:template>
539
540 <xsl:template match="gsf:choose-metadata">
541 <xslt:choose>
542 <xsl:for-each select="gsf:metadata">
543 <xslt:when>
544 <xsl:attribute name="test">(.//metadataList)[last()]/metadata[@name='<xsl:call-template name="getMetadataName"/>']</xsl:attribute>
545 <xsl:apply-templates select="."/>
546 </xslt:when>
547 </xsl:for-each>
548 <xsl:if test="gsf:default">
549 <xslt:otherwise>
550 <xsl:apply-templates select="gsf:default"/>
551 </xslt:otherwise>
552 </xsl:if>
553 </xslt:choose>
554 </xsl:template>
555
556 <xsl:template match="gsf:switch">
557 <xsl:variable name="meta-name">
558 <xsl:for-each select="gsf:metadata">
559 <xsl:call-template name="getMetadataName"/>
560 </xsl:for-each>
561 </xsl:variable>
562 <xslt:variable name="meta">
563 <xsl:choose>
564 <xsl:when test="@preprocess">
565 <xslt:value-of select="util:{@preprocess}((.//metadataList)[last()]/metadata[@name='{$meta-name}'], /page/@lang )"/>
566 </xsl:when>
567 <xsl:otherwise>
568 <xslt:value-of select="(.//metadataList)[last()]/metadata[@name='{$meta-name}']"/>
569 </xsl:otherwise>
570 </xsl:choose>
571 </xslt:variable>
572 <xslt:choose>
573 <xsl:for-each select="gsf:when">
574 <xslt:when test="util:{@test}($meta, '{@test-value}')">
575 <xsl:apply-templates/>
576 </xslt:when>
577 </xsl:for-each>
578 <xsl:if test="gsf:otherwise">
579 <xslt:otherwise>
580 <xsl:apply-templates select="gsf:otherwise/node()"/>
581 </xslt:otherwise>
582 </xsl:if>
583 </xslt:choose>
584 </xsl:template>
585
586 <!--
587 <gsf:headMetaTags> exists for controlling the <meta name="x" content="y"> elements that appear in the HTML <head></head>
588 XPATH is used to select this item (in header.xsl). It does not need an explicit definition here in this file
589 -->
590
591 <xsl:template match="*">
592 <xsl:copy>
593 <xsl:copy-of select="@*"/>
594 <xsl:apply-templates/>
595 </xsl:copy>
596 </xsl:template>
597
598</xsl:stylesheet>
599
600
Note: See TracBrowser for help on using the repository browser.