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

Last change on this file since 29091 was 29091, checked in by kjdon, 10 years ago

can now set pos='classifiedBy' to output the metadata value used for classifying the document into the current position

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