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

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

allow comma separated metadata names in gsf:metadata name attribute. Then we can do something like <gsf:metadata name='dc.Date,Date' pos='classifiedBy'/> to output the value is a classifier list that the current document was classified By

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