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

Last change on this file since 28307 was 28307, checked in by kjdon, 11 years ago

when doing collection metadata, need the parentheses around the entire path up to metadataList

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