source: main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl@ 36072

Last change on this file since 36072 was 36072, checked in by kjdon, 2 years ago

tidying up for getting rid of berry basket, leaving only favourite basket. favouritebasket and documentbasket are now servlet params.

File size: 50.3 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
5 xmlns:gslib="http://www.greenstone.org/XSL/Library"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil"
8 xmlns:gs3="http://www.greenstone.org/gs3"
9 xmlns:xlink="http://www.w3.org/1999/xlink"
10 xmlns:gsvar="http://www.greenstone.org/skinning-var"
11 exclude-result-prefixes="util xalan gslib gsf xslt gs3 gsvar xlink">
12<!-- all namespaces used by greenstone should be defined here and listed in exclude-result-prefixes, including those in core/transform/preProcess.xsl, otherwise xmlns attributes will be included in the html output -->
13
14 <!-- force lower priority on xsl:output, so other files like rss.xsl can override with their own xsl:output stmt
15 If other files don't specify any, gslib.xsl specifies html output as default and defines a loose DOCTYPE for it. -->
16 <xsl:import href="html-output.xsl" />
17
18 <!-- some global parameters - these are set by whoever is invoking the transformation
19 Any servlet init parameters can be accessed by adding a param here-->
20 <xsl:param name="interface_name"/>
21 <xsl:param name="library_name"/>
22 <xsl:param name="site_name"/>
23 <xsl:param name="use_client_side_xslt"/>
24 <xsl:param name="filepath"/>
25 <xsl:param name="google_tracking_id"/>
26 <xsl:param name="googlesignin_client_id"/>
27 <xsl:param name="favouritebasket"/>
28 <xsl:param name="documentbasket"/>
29
30 <xsl:variable name="unselected_favourite_icon">favourite-star-transparent-unselected32.png</xsl:variable>
31 <xsl:variable name="selected_favourite_icon">favourite-star-transparent-selected32.png</xsl:variable>
32
33 <!-- every pages ....................................................................... -->
34
35 <xsl:template name="siteName">
36 <xsl:value-of select="/page/pageResponse/displayItemList/displayItem[@name='siteName']"/>
37 </xsl:template>
38
39 <xsl:template name="siteDescription">
40 <xsl:value-of select="/page/pageResponse/displayItemList/displayItem[@name='siteDescription']"/>
41 </xsl:template>
42
43 <xsl:template name="siteLink">
44 <a href="./{$library_name}">
45 <xsl:call-template name="siteName"/>
46 </a>
47 <xsl:text> </xsl:text>
48 </xsl:template>
49
50 <xsl:variable name="a">
51 <xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/>
52 </xsl:variable>
53
54 <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
55
56 <xsl:variable name="favouriteBasketOn" select="$favouritebasket = 'true' and /page/pageRequest/paramList/param[@name='favouritebasket' and @value='on']"/>
57 <xsl:variable name="documentBasketOn" select="$documentbasket = 'true' and /page/pageRequest/paramList/param[@name='documentbasket' and @value='on']"/>
58
59 <xsl:variable name="thisCollectionEditor">
60 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'c']/@value"/>
61 <xsl:text>-collection-editor</xsl:text>
62 </xsl:variable>
63
64 <!-- template to get the name of the current collection -->
65 <xsl:template name="collectionName">
66 <xsl:choose>
67 <xsl:when test="/page/pageResponse/collection/displayItemList/displayItem[@name='name']">
68 <xsl:value-of select="/page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
69 </xsl:when>
70 <xsl:when test="/page/pageResponse/collection/@name">
71 <xsl:value-of select="/page/pageResponse/collection/@name"/>
72 </xsl:when>
73 </xsl:choose>
74 </xsl:template>
75
76 <!-- template to get the name of the current collection or 'all collections' if not in a specific collection -->
77 <xsl:template name="collectionNameOrAll">
78 <xsl:choose>
79 <xsl:when test="/page/pageResponse/collection">
80 <xsl:value-of select="/page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
81 </xsl:when>
82 <xsl:otherwise>All Collections</xsl:otherwise>
83 </xsl:choose>
84 </xsl:template>
85
86 <xsl:template name="collectionNameShort">
87 <xsl:value-of select="/page/pageResponse/collection/@name"/>
88 </xsl:template>
89 <xsl:template name="collectionNameLinked">
90 <xsl:if test="/page/pageResponse/collection">
91 <a>
92 <xsl:attribute name="href">./<xsl:value-of select="$library_name"/>/collection/<xsl:call-template name="collectionNameShort"/>/page/about</xsl:attribute>
93 <xsl:call-template name="collectionName"/>
94 </a>
95 </xsl:if>
96 </xsl:template>
97
98 <xsl:template name="collectionMeta">
99 <xsl:param name="name"/>
100 <xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name=$name]"/>
101 </xsl:template>
102
103 <!-- text to get the name of the current service ("Browse","Search" etc) -->
104 <xsl:template name="serviceName">
105 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
106 </xsl:template>
107
108 <xsl:template name="textDirectionAttribute">
109 <xsl:attribute name="dir">
110 <xsl:choose>
111 <xsl:when test="/page/@lang='ar' or /page/@lang='fa' or /page/@lang='he' or /page/@lang='ur' or /page/@lang='ps' or /page/@lang='prs'">rtl</xsl:when>
112 <xsl:otherwise>ltr</xsl:otherwise>
113 </xsl:choose>
114 </xsl:attribute>
115 </xsl:template>
116
117 <xsl:template name="actionClass">
118 <xsl:attribute name="class"><xsl:value-of select="/page/pageRequest/@action"/>Action <xsl:if test="/page/pageRequest/@subaction"><xsl:value-of select="/page/pageRequest/@subaction"/>Subaction</xsl:if></xsl:attribute>
119 </xsl:template>
120 <!-- username, if logged in -->
121 <!--
122 <xsl:template name="username">
123 <xsl:if test="$un_s!=''">
124 <xsl:if test="$asn!='' and $asn!='0'">
125 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/> : <xsl:value-of select="$un_s"/>
126 </xsl:if>
127 </xsl:if>
128 </xsl:template>
129 -->
130 <xsl:template name="defaultDividerBar">
131 <xsl:param name="text"/>
132 <xsl:choose>
133 <xsl:when test="$text">
134 <div class="divbar">
135 <xsl:value-of select="$text"/>
136 </div>
137 </xsl:when>
138 <xsl:otherwise>
139 <div class="divbar">
140 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
141 </div>
142 </xsl:otherwise>
143 </xsl:choose>
144 </xsl:template>
145
146 <xsl:template match="error">
147 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'error')"/><gsf:space/> <xsl:value-of select="."/>
148 </xsl:template>
149 <xsl:template name="displayErrorsIfAny">
150 <xsl:if test="descendant::error">
151 <script language="Javascript">
152 <xsl:text disable-output-escaping="yes">
153 function removeAllChildren(node) {
154 while (node.hasChildNodes()) {
155 node.removeChild(node.firstChild);
156 }
157 }
158
159 function toggleHideError(obj) {
160 if (obj.style.display == "none") {
161 obj.style.display = "";
162 hide_link = document.getElementById("hide");
163 removeAllChildren(hide_link);
164 hide_link.appendChild(document.createTextNode("</xsl:text>
165 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/>
166 <xsl:text disable-output-escaping="yes">"));
167 } else {
168 obj.style.display = "none";
169 hide_link = document.getElementById("hide");
170 removeAllChildren(hide_link);
171 hide_link.appendChild(document.createTextNode("</xsl:text>
172 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
173 <xsl:text disable-output-escaping="yes">"));
174 }
175 }
176 </xsl:text>
177 </script>
178 <p align="right">
179 <a id="hide" href="javascript:toggleHideError(error);">
180 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
181 </a>
182 </p>
183 <div id="error" style="display: none;">
184 <xsl:apply-templates select="descendant::error"/>
185 </div>
186 </xsl:if>
187 </xsl:template>
188
189 <xsl:template name="noTextBar">
190 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><!-- could also be expressed &#160; -->
191 </xsl:template>
192
193 <xsl:template name="poweredByGS3TextBar">
194 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
195 </xsl:template>
196
197 <xsl:template name="rightArrow">
198 <xsl:text disable-output-escaping="yes"> » </xsl:text> <!-- could also be expressed &amp;raquo; or &#187; but prefer literal UTF8 char so it renders correctly if used in title of browser-tab -->
199 </xsl:template>
200
201 <!-- site home ....................................................................... -->
202 <xsl:template name="siteHomePageTitle">
203 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
204 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
205 <xsl:text> </xsl:text>
206 </xsl:template>
207
208 <xsl:template name="selectACollectionTextBar">
209 <xsl:choose>
210 <xsl:when test="/page/pageResponse/groupList/group and /page/pageResponse/collectionList/collection">
211 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection_or_group')"/>
212 </xsl:when>
213 <xsl:when test="/page/pageResponse/groupList/group">
214 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_group')"/>
215 </xsl:when>
216 <xsl:when test="/page/pageResponse/collectionList/collection">
217 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
218 </xsl:when>
219 <xsl:otherwise>
220 <xsl:choose>
221 <xsl:when test="/page/pageResponse/pathList/group">
222 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.no_collections_group')"/>
223 </xsl:when>
224 <xsl:otherwise>
225 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.no_collections')"/>
226 </xsl:otherwise>
227 </xsl:choose>
228 </xsl:otherwise>
229 </xsl:choose>
230 </xsl:template>
231
232 <xsl:template name="crossCollectionQuickSearchForm">
233 <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
234 </xsl:template>
235
236 <xsl:template match="service[@name='TextQuery']">
237 <form name="QuickSearch" method="get" action="{$library_name}">
238 <input type="hidden" name="a" value="q"/>
239 <input type="hidden" name="rt" value="rd"/>
240 <input type="hidden" name="s" value="{@name}"/>
241 <xsl:choose>
242 <xsl:when test="/page/pageRequest/paramList/param[@name='group']/@value">
243 <input type="hidden" name="s1.group">
244 <xsl:attribute name="value">
245 <xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value" />
246 </xsl:attribute>
247 </input>
248 </xsl:when>
249 <xsl:otherwise>
250 <input type="hidden" name="s1.collection" value="all" />
251 </xsl:otherwise>
252 </xsl:choose>
253 <input type="text" name="s1.query" size="20"/>
254 <input type="submit">
255 <xsl:attribute name="value">
256 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/>
257 </xsl:attribute>
258 </input>
259 </form>
260 </xsl:template>
261
262 <xsl:template name="groupName">
263 <xsl:param name="path"/>
264 <xsl:value-of select="/page/pageResponse/pathList/group[@path=$path]/title"/>
265 </xsl:template>
266 <xsl:template name="groupDescription">
267 <xsl:param name="path"/>
268 <xsl:value-of select="/page/pageResponse/pathList/group[@path=$path]/description"/>
269 </xsl:template>
270
271 <xsl:template name="groupHref">
272 <xsl:param name="path"/>
273 <xsl:value-of select="$library_name"/>/group/<xsl:value-of select="@path"/>
274 </xsl:template>
275
276 <xsl:template name="groupLinkWithImage">
277 <xsl:variable name="desc"><xsl:value-of select="description"/></xsl:variable>
278 <xsl:variable name="group_href"><xsl:value-of select="$library_name"/>/group/<xsl:if test="/page/pageRequest/paramList/param[@name='group']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/>/</xsl:if><xsl:value-of select="@name"/></xsl:variable>
279
280 <xsl:choose>
281 <xsl:when test="util:checkFileExistence($site_name, backgroundImage)">
282 <a href="{$group_href}" title="{$desc}">
283 <img class="groupLinkImage">
284 <xsl:attribute name="alt"><xsl:value-of select="displayItemList/displayItem[@name='name']"/></xsl:attribute>
285 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/<xsl:value-of select="backgroundImage"/></xsl:attribute>
286 </img>
287 </a>
288 </xsl:when>
289 <xsl:otherwise>
290 <a href="{$group_href}" title="{$desc}">
291 <div class="groupLink ui-corner-all">
292 <div class="groupLinkText ui-widget-content ui-corner-top">
293 <xsl:choose>
294 <xsl:when test="boolean(title)">
295 <xsl:value-of select="title"/>
296 </xsl:when>
297 <xsl:otherwise>
298 <xsl:value-of select="@name"/>
299 </xsl:otherwise>
300 </xsl:choose>
301 </div>
302 <div style="height:15px;" class="ui-state-default ui-corner-bottom"><xsl:text> </xsl:text></div>
303 </div>
304 </a>
305 </xsl:otherwise>
306 </xsl:choose>
307 </xsl:template>
308
309 <xsl:template name="collectionLinkWithImage">
310 <xsl:variable name="desc"><xsl:value-of select="displayItemList/displayItem[@name='shortDescription']"/></xsl:variable>
311 <xsl:variable name="coll_href"><xsl:value-of select="$library_name"/>/collection/<xsl:if test="/page/pageRequest/paramList/param[@name='group']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='group']/@value"/>/</xsl:if><xsl:value-of select="@name"/>/page/about<xsl:choose><xsl:when test="libraryParamList/param">?<xsl:for-each select="libraryParamList/param"><xsl:value-of select="@name"/>=<xsl:value-of select="@default"/>&amp;</xsl:for-each></xsl:when></xsl:choose></xsl:variable>
312 <xsl:choose>
313 <xsl:when test="displayItemList/displayItem[@name='smallicon']">
314 <a href="{$coll_href}" title="{$desc}">
315 <img class="collectionLinkImage">
316 <xsl:attribute name="alt"><xsl:value-of select="displayItemList/displayItem[@name='name']"/></xsl:attribute>
317 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItemList/displayItem[@name='smallicon']"/></xsl:attribute>
318 </img>
319 </a>
320 </xsl:when>
321 <xsl:otherwise>
322 <a href="{$coll_href}" title="{$desc}">
323 <div class="collectionLink ui-corner-all">
324 <div class="collectionLinkText ui-widget-content ui-corner-top">
325 <xsl:choose><xsl:when test="displayItemList/displayItem[@name='name']"><xsl:value-of select="displayItemList/displayItem[@name='name']"/></xsl:when>
326 <xsl:otherwise>
327 <xsl:value-of select="@name"/>
328 </xsl:otherwise>
329 </xsl:choose>
330
331 </div>
332 <div style="height:15px;" class="ui-state-default ui-corner-bottom"><xsl:text> </xsl:text></div>
333 </div>
334 </a>
335 </xsl:otherwise>
336 </xsl:choose>
337 </xsl:template>
338
339 <xsl:template name="serviceClusterList">
340 <xsl:apply-templates select="serviceClusterList"/>
341 </xsl:template>
342
343 <xsl:template match="serviceClusterList">
344 <xsl:for-each select="serviceCluster">
345 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
346 <xsl:value-of select="@name"/>
347 <xsl:value-of select="displayItemList/displayItem[@name='name']"/>
348 </a>
349 </xsl:for-each>
350 </xsl:template>
351
352 <xsl:template name="serviceLink">
353 <div class="paramLabel">
354 <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}">
355 <xsl:value-of select="displayItem[@name='name']"/>
356 </a>
357 </div>
358 <div class="paramValue">
359 <xsl:value-of select="displayItem[@name='description']"/>
360 </div>
361 <br class="clear"/>
362 </xsl:template>
363
364 <xsl:template name="authenticationLink">
365 <xsl:for-each select="//serviceList/service[@type='authen']">
366 <div class="paramLabel">
367 <a href="{$library_name}/admin/ListUsers">
368 <xsl:value-of select="displayItem[@name='name']"/>
369 </a>
370 </div>
371 <div class="paramValue">
372 <xsl:value-of select="displayItem[@name='description']"/>
373 </div>
374 </xsl:for-each>
375 </xsl:template>
376
377 <xsl:template name="registerLink">
378 <xsl:for-each select="//serviceList/service[@type='authen']">
379 <div class="paramLabel">
380 <a href="{$library_name}/admin/Register"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.register')"/>
381 </a>
382 </div>
383 <div class="paramValue">
384<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.register_as_new')"/>
385 </div>
386 </xsl:for-each>
387 </xsl:template>
388
389 <xsl:template name="aboutGreenstoneLink">
390 <div class="paramLabel">
391 <a href="{$library_name}/page/gsdl"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl.title')"/></a>
392 </div>
393 <div class="paramValue">
394 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl.brief')"/>
395 </div>
396 </xsl:template>
397
398 <xsl:template name="libraryInterfaceLink">
399 <div class="paramLabel">
400 <!--
401 Using HTML5 download attribute to anchor tag, providing download-as-filename value, so Gli App JNLP file downloads.
402 Seems we don't need to set the MIME type for downloaded JNLP to launch, if program associations are correctly set up.
403 -->
404 <a href="{$library_name}?a=p&amp;sa=gli4gs3" download="GLIappWebStart.jnlp">
405 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
406 </a>
407 </div>
408 <div class="paramValue">
409 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.gliapp_webstart')"/>
410 </div>
411 </xsl:template>
412
413 <xsl:template name="depositorTitleMainLink">
414 <div class="paramLabel">
415 <a href="{$library_name}?a=de"><!-- HAS SIDE-EFFECT: <a href="{$library_name}/page/depositor_home">-->
416 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'depositor.title')"/>
417 </a>
418 </div>
419 <div class="paramValue">
420 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'depositor.description')"/>
421 </div>
422 </xsl:template>
423
424 <xsl:template name="depositorTitleAndLink">
425 <a href="{$library_name}?a=de"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'depositor.title')"/></a>
426 </xsl:template>
427
428 <xsl:template name="greenstoneLogoAlternateText">
429 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
430 </xsl:template>
431
432 <!-- about page - collection home ....................................................................... -->
433 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
434 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
435 <xsl:variable name="siteName" select="$site_name"/>
436 <xsl:variable name="siteURL" select="/page/pageResponse/metadataList/metadata[@name = 'siteURL']"/>
437
438 <!--
439 Already defined above as a variable, not sure why if way being defined here again as a 'param'
440 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
441 -->
442 <xsl:param name="pageType"/>
443 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
444 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
445
446<!--
447_httpimages_ {_httpweb_/images}
448_httpscript_ {_httpweb_/script}
449_httpstyle_ {_httpweb_/style}
450_httpflash_ {_httpweb_/flash}
451_httpjava_ {_httpweb_/java}
452-->
453
454
455 <xsl:template name="define-js-variable">
456 <xsl:param name="name"/>
457 <xsl:param name="value"/>
458 <script type="text/javascript">
459 gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
460 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
461 <xsl:value-of select="$value"/>
462 <xslt:text disable-output-escaping="yes">";</xslt:text>
463 </script>
464 </xsl:template>
465
466 <xsl:variable name="_httpcollection_" select="$httpPath"/>
467 <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
468 <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
469
470 <xsl:template name="define-js-macro-variables">
471
472 <xsl:call-template name="define-js-variable">
473 <xsl:with-param name="name" select="'_httpbrowse_'"/>
474 <xsl:with-param name="value" select="$_httpbrowse_"/>
475 </xsl:call-template>
476
477 <xsl:call-template name="define-js-variable">
478 <xsl:with-param name="name" select="'_httpquery_'"/>
479 <xsl:with-param name="value" select="$_httpquery_"/>
480 </xsl:call-template>
481
482 </xsl:template>
483
484
485 <xsl:template name="aboutCollectionPageTitle">
486 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
487 <xsl:value-of select="/page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
488 <xsl:text> </xsl:text>
489 </xsl:template>
490
491 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
492 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
493 <xsl:choose>
494 <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
495 <img border="0">
496 <xsl:attribute name="src"><xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItemList/displayItem[@name='icon']"/></xsl:attribute>
497 <xsl:attribute name="alt">
498 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
499 </xsl:attribute>
500 <xsl:attribute name="title">
501 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
502 </xsl:attribute>
503 </img>
504 </xsl:when>
505 <xsl:otherwise>
506 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
507 </xsl:otherwise>
508 </xsl:choose>
509 </a>
510 </xsl:template>
511
512 <xsl:template name="homeButtonTop">
513 <a href="{$library_name}?a=p&amp;sa=home">
514 <xsl:attribute name="title">
515 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
516 </xsl:attribute>
517 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
518 </a>
519 </xsl:template>
520
521 <xsl:template name="helpButtonTop">
522 <xsl:choose>
523 <xsl:when test="$pageType='help'">
524 <li>
525 <a>
526 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
527 </a>
528 </li>
529 </xsl:when>
530 <xsl:otherwise>
531 <li>
532 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
533 <xsl:attribute name="title">
534 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
535 </xsl:attribute>
536 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
537 </a>
538 </li>
539 </xsl:otherwise>
540 </xsl:choose>
541 </xsl:template>
542
543 <xsl:template name="preferencesButtonTop">
544 <xsl:choose>
545 <xsl:when test="$pageType='pref'">
546 <li>
547 <a>
548 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
549 </a>
550 </li>
551 </xsl:when>
552 <xsl:otherwise>
553 <li>
554 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
555 <xsl:attribute name="title">
556 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
557 </xsl:attribute>
558 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
559 </a>
560 </li>
561 </xsl:otherwise>
562 </xsl:choose>
563 </xsl:template>
564
565 <xsl:template name="servicesNavigationBar">
566 <xsl:for-each select="$this-element/serviceList/service">
567 <xsl:variable name="action">
568 <xsl:choose>
569 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
570 <xsl:when test="@type='query'">q</xsl:when>
571 <xsl:when test="@type='browse'">b</xsl:when>
572 <xsl:when test="@type='process'">pr</xsl:when>
573 <xsl:when test="@type='applet'">a</xsl:when>
574 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
575 </xsl:choose>
576 </xsl:variable>
577 <xsl:choose>
578 <xsl:when test="$action='CURRENT'">
579 <li>
580 <a>
581 <xsl:value-of select="displayItem[@name='name']"/>
582 </a>
583 </li>
584 </xsl:when>
585 <xsl:when test="$action !='DO_NOT_DISPLAY'">
586 <li>
587 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
588 <xsl:if test="displayItem[@name='description']">
589 <xsl:attribute name="title">
590 <xsl:value-of select="displayItem[@name='description']"/>
591 </xsl:attribute>
592 </xsl:if>
593 <xsl:value-of select="displayItem[@name='name']"/>
594 </a>
595 </li>
596 </xsl:when>
597 </xsl:choose>
598 </xsl:for-each>
599 </xsl:template>
600
601 <xsl:template name="collectionDescriptionTextAndServicesLinks">
602 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
603 </xsl:template>
604
605 <!--
606 Solution to problem where incoming collection description contains HTML and we want to preserve
607 that HTML instead of XML's default behaviour stripping out all tags and just concatenating their text
608 content.
609 The actual solution is here:
610 https://stackoverflow.com/questions/19998180/xsl-copy-nodes-without-xmlns
611 - Close but adds namespacs to the first HTML tag:
612 https://stackoverflow.com/questions/6199345/how-to-copy-all-child-nodes-of-any-type-of-a-template-context-element
613 Other links that are a learning experience:
614 - https://support.microsoft.com/en-us/help/264665/how-to-display-html-in-xsl-style-sheet
615 (tags need to come in in entity form for xslt to remove the entities in output)
616 - https://forums.asp.net/t/1414309.aspx?Decoding+HTML+after+applying+an+XLST+transform+to+an+XML+control
617 (same problem)
618 - https://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html
619 (general information)
620 - https://stackoverflow.com/questions/5876382/using-xslt-to-copy-all-nodes-in-xml-with-support-for-special-cases
621 (close to solution)
622 -->
623 <xsl:template match="collection|serviceCluster">
624 <!-- original way: does not preserve html tags -->
625 <!--<xsl:value-of select="displayItemList/displayItem[@name='description']" disable-output-escaping="yes"/>-->
626 <xsl:apply-templates select="displayItemList/displayItem[@name='description']"/>
627
628 <!-- Don't do this. It seems to remove any text nodes directly within this displayItem
629 before copying only the subdnodes -->
630 <!-- <xsl:apply-templates select="displayItemList/displayItem[@name='description']/*" mode="copy-no-namespaces"/> -->
631
632 <!-- Don't do this: it will also copy the <displayItem> element itself into the HTML output -->
633 <!--<xsl:copy-of select="displayItemList/displayItem[@name='description']"/>-->
634
635 <!-- The other way: requires the input to already be entity encoded for xslt to get it right,
636 to get it ending up as tags in the HTML generated. An example of it working below.
637 But that means we have to get the runtime code to send entity encoded elements, which
638 is not what we want.
639 -->
640 <!--<xsl:text disable-output-escaping="yes">&lt;b&gt;hello&lt;/b&gt;</xsl:text>-->
641
642<!-- Uncomment this section if you want the collection service links and their descriptions to appear -->
643 <!--<xsl:apply-templates select="serviceList">
644 <xsl:with-param name="collName" select="$collName"/>
645 </xsl:apply-templates>-->
646 </xsl:template>
647
648 <!-- preserve any HTML tags *within* the collection description
649 Why is this adding an xmlns namespace to the first HTML tag encountered and converting
650 non html entities like the apostrophe character into their entity forms?
651 This seems to assume entities in the input should be converted:
652 https://stackoverflow.com/questions/31517944/xsl-disable-output-escaping-copy-of
653 But I'm wondering why when there's no entity in the input, copy-of produces entities
654 for chars like apostrophe in the output?
655 Note: there's xsl:copy and xsl:copy-of, we want copy-of!
656 - https://www.w3schools.com/xml/ref_xsl_el_copy.asp
657 - vs https://www.w3schools.com/XML/ref_xsl_el_copy-of.asp
658
659 Info on avoiding doe/disable-output-escaping at https://saxonica.plan.io/issues/3214
660 https://stackoverflow.com/questions/31517944/xsl-disable-output-escaping-copy-of
661 -->
662 <xsl:template match="displayItem[@name='description']">
663 <!-- don't do this: it adds an xmlns namespace to the first/root html element in displayItem -->
664 <!--<xsl:copy-of select="node()"/>-->
665 <xsl:apply-templates select="node()" mode="copy-no-namespaces"/>
666 </xsl:template>
667 <!-- On mode attribute: https://www.w3schools.com/xml/ref_xsl_el_apply-templates.asp
668 https://stackoverflow.com/questions/4486869/can-one-give-me-the-example-for-mode-of-template-in-xsl
669 https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256045(v=vs.100)?redirectedfrom=MSDN
670 -->
671 <xsl:template match="*" mode="copy-no-namespaces">
672 <xsl:element name="{local-name()}">
673 <xsl:copy-of select="@*"/>
674 <xsl:apply-templates select="node()" mode="copy-no-namespaces"/>
675 </xsl:element>
676 </xsl:template>
677
678 <xsl:template match="comment()| processing-instruction()" mode="copy-no-namespaces">
679 <xsl:copy/>
680 </xsl:template>
681
682 <xsl:template match="serviceList">
683 <xsl:param name="collName"/>
684 <h3>
685 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
686 </h3>
687 <p>
688 <xsl:choose>
689 <xsl:when test="service">
690 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
691 </xsl:when>
692 <xsl:otherwise>
693 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
694 </xsl:otherwise>
695 </xsl:choose>
696 </p>
697 <xsl:if test="service">
698 <div id="servicelist">
699 <xsl:for-each select="service">
700 <xsl:sort select="position()" order="descending" data-type="number"/>
701 <xsl:variable name="action">
702 <xsl:choose>
703 <xsl:when test="@type='query'">q</xsl:when>
704 <xsl:when test="@type='process'">pr</xsl:when>
705 <xsl:when test="@type='applet'">a</xsl:when>
706 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
707 </xsl:choose>
708 </xsl:variable>
709 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
710 <div class="paramLabel">
711 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
712 <xsl:value-of select="displayItem[@name='name']"/>
713 </a>
714 </div>
715 <div class="paramLabel">
716 <xsl:value-of select="displayItem[@name='description']"/>
717 </div>
718 <br class="clear"/>
719 </xsl:if>
720 </xsl:for-each>
721 </div>
722 </xsl:if>
723
724 </xsl:template>
725
726 <!-- classifier page ............................................................................ -->
727 <xsl:template name="collapsedNavigationTab">
728 <xsl:param name="type"/>
729 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
730 <li>
731 <xsl:if test="$isCurrent">
732 <xsl:attribute name="class">current</xsl:attribute>
733 </xsl:if>
734 <a>
735 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
736 <xsl:attribute name="title">
737 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
738 </xsl:attribute>
739 </xsl:if>
740 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=q&amp;rt=d&amp;s=<xsl:value-of select="service[@type=$type]/@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
741 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
742 </a>
743 </li>
744 </xsl:template>
745
746 <xsl:template name="navigationTab">
747 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
748 <xsl:variable name="action">
749 <xsl:choose>
750 <xsl:when test="@type='query'">q</xsl:when>
751 <xsl:when test="@type='browse'">b</xsl:when>
752 <xsl:when test="@type='process'">pr</xsl:when>
753 <xsl:when test="@type='applet'">a</xsl:when>
754 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
755 </xsl:choose>
756 </xsl:variable>
757 <xsl:if test="$action!='DO_NOT_DISPLAY'">
758 <li>
759 <xsl:if test="$isCurrent">
760 <xsl:attribute name="class">current</xsl:attribute>
761 </xsl:if>
762 <a>
763 <xsl:if test="displayItem[@name='description']">
764 <xsl:attribute name="title">
765 <xsl:value-of select="displayItem[@name='description']"/>
766 </xsl:attribute>
767 </xsl:if>
768 <xsl:choose>
769 <xsl:when test="classifierList/classifier/@name">
770 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=<xsl:value-of select="$action"/>&amp;rt=s&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;cl=<xsl:value-of select="classifierList/classifier/@name"/></xsl:attribute>
771 </xsl:when>
772 <xsl:otherwise>
773 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=<xsl:value-of select="$action"/>&amp;rt=d&amp;s=<xsl:value-of select="@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:attribute>
774 </xsl:otherwise>
775 </xsl:choose>
776 <xsl:value-of select="displayItem[@name='name']"/>
777 </a>
778 </li>
779 </xsl:if>
780 </xsl:template>
781
782 <xsl:template name="classifierLink">
783 <xsl:if test="@name=/page/pageResponse/classifier/@name">
784 <xsl:attribute name="class">current</xsl:attribute>
785 </xsl:if>
786 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
787 <xsl:value-of select="displayItem[@name='description']"/>
788 </a>
789 </xsl:template>
790
791 <!-- query page ............................................................................ -->
792<!-- <xsl:template name="indexName">
793 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
794 </xsl:template>
795
796 <xsl:template name="queryPageCollectionName">
797 <xsl:choose>
798 <xsl:when test="/page/pageResponse/collection">
799 <gslib:aboutCollectionPageTitle/>
800 </xsl:when>
801 <xsl:otherwise>Cross-Collection</xsl:otherwise>
802 </xsl:choose>
803 </xsl:template>-->
804
805 <!--
806BASKET TEMPLATES
807These get used on many different pages to add the favourites basket or
808document basket to the site
809 -->
810
811 <xsl:template name="displayBaskets">
812
813 <xsl:if test="$favouriteBasketOn">
814 <!-- show the favourites 'basket' if it's turned on -->
815 <gslib:gotoFavourites/>
816 <xsl:text> </xsl:text>
817 </xsl:if>
818
819 <!-- is the document basket facility turned on, and does the user have premission to use it? -->
820 <xsl:if test="$documentBasketOn and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
821
822 <gslib:documentBasket/>
823 <xsl:text> </xsl:text>
824 </xsl:if>
825 <!--</xsl:if>-->
826 </xsl:template>
827
828
829 <!--
830 Goto Favourites Template
831 This gets used on many different pages to add the
832 goto favourites check-out functionality to the site
833 -->
834 <xsl:template name="gotoFavourites">
835 <xsl:if test="$favouriteBasketOn">
836 <!-- set up these gsf variables so we have access in javascript -->
837 <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
838 <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>
839 <div id="berrybasket" class="hide">
840 <img src="interfaces/{$interface_name}/images/{$selected_favourite_icon}" title="click to add to favourites" width="16" height="16" border="0" />
841 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.title')"/><xsl:text> </xsl:text></span>
842 <span id="favouritesCountDisplay">...</span>
843
844 <div><a id="favouritesFullViewLink" style="display: block;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.full')"/></a></div>
845 </div>
846 <gsf:script>
847 //set url and show full view link
848 var fullView = YAHOO.util.Dom.get('favouritesFullViewLink');
849 //Find the collection in the cgi parameters
850 var url = window.location.href;
851 var colstart = url.indexOf("&amp;c=");
852 var collectionName = "";
853 if (colstart != -1)
854 {
855 var colend = url.indexOf("&amp;", (colstart + 1));
856 if (colend == -1)
857 {
858 colend = url.length - 1;
859 }
860 collectionName = url.substring(colstart + 3, colend);
861 }
862
863 fullView.setAttribute("href",gs.xsltParams.library_name + "?a=g&amp;sa=fav&amp;c=&amp;s=DisplayList&amp;rt=r&amp;p.c=" + collectionName);
864 fullView.style.display='block';
865
866 </gsf:script>
867 </xsl:if>
868 </xsl:template>
869
870
871
872
873 <!-- put the drag&drop document basket on the page -->
874 <xsl:template name="documentBasket">
875 <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation and /page/pageRequest/userInformation/@editEnabled = 'true' and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
876 <div id="documentbasket" class="show">
877 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'db.doc_basket')"/><xsl:text> </xsl:text></span>
878 <span id="documentBasketExpandCollapseLinks" style="display: none;">
879 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
880 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
881 </span>
882 <div id="documenthandle">
883 <span>
884 <xsl:text> </xsl:text>
885 </span>
886 </div>
887 <div id="documentpages">
888 <span>
889 <xsl:text> </xsl:text>
890 </span>
891 </div>
892 <div>
893 <a href="javascript:clearBasket();"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.clear')"/></a>
894 </div>
895 </div>
896 </xsl:if>
897 </xsl:template>
898
899 <!-- include the required js and css for favourites-->
900 <xsl:template name="favouritesHeadTags">
901 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
902 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
903 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
904 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
905 <script type="text/javascript" src="interfaces/{$interface_name}/js/favouritebasket/favouritebasket.js"><xsl:text> </xsl:text></script>
906 <link rel="stylesheet" href="interfaces/{$interface_name}/style/favourites.css" type="text/css"/>
907 </xsl:template>
908
909 <!-- include the required javascript and css for document baskets
910 Note, this may have unneeded things in it -->
911 <xsl:template name="documentBasketHeadTags">
912 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
913 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
914 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
915 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
916 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
917 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
918 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
919 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
920 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
921 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
922 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
923
924 <!-- Combo-handled YUI CSS files: -->
925 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
926
927 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
928 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
929 <!-- Combo-handled YUI JS files: -->
930 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
931 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
932 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
933 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
934 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
935 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
936 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
937 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
938 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
939 </xsl:template>
940
941 <xsl:template name="documentFavouriteForClassifierOrSearchPage">
942 <xsl:if test="$favouriteBasketOn">
943 <xsl:variable name="collname"><xsl:choose><xsl:when test="@collection"><xsl:value-of select="@collection"/></xsl:when><xsl:otherwise><xsl:value-of select="/page/pageResponse/collection/@name"/></xsl:otherwise></xsl:choose></xsl:variable>
944 <img src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" title="click to add to favourites" width="20" height="20" border="0" onclick="toggleFavourite(this)" data-is-favourite="false">
945 <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
946 </img>
947 </xsl:if>
948 </xsl:template>
949
950
951 <xsl:template name="documentFavouriteForDocumentPage">
952 <xsl:variable name="selectedNode">
953 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
954 </xsl:variable>
955 <xsl:variable name="rootNode">
956 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
957 </xsl:variable>
958 <xsl:if test="$favouriteBasketOn">
959 <div id="documentberries">
960 <img id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" alt="in basket" width="15" height="15" border="0"/>
961 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
962 <!--<xsl:if test="$selectedNode != $rootNode">
963 <img id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/{$berry_icon}" alt="in basket" width="15" height="15" border="0"/>
964 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
965 </xsl:if>-->
966 </div>
967 </xsl:if>
968 </xsl:template>
969
970 <!-- document page -->
971 <xsl:template name="documentTitle">
972 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
973 </xsl:template>
974 <xsl:template name="coverImage">
975 <img>
976 <xsl:attribute name="src"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg</xsl:attribute>
977 </img>
978 </xsl:template>
979
980 <xsl:template name="previousNextButtons">
981 <!-- prev -->
982 <a>
983 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;d=<xsl:value-of select="@selectedNode"/>.pp&amp;sib=1&amp;p.s=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.a']/@value"/></xsl:attribute>
984 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
985 </a>
986 <!-- next -->
987 <a>
988 <xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;d=<xsl:value-of select="@selectedNode"/>.np&amp;sib=1&amp;p.s=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>&amp;p.sa=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>&amp;p.a=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.a']/@value"/></xsl:attribute>
989 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
990 </a>
991 </xsl:template>
992
993
994 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
995 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
996 <xsl:call-template name="langfrag">
997 <xsl:with-param name="name">dse</xsl:with-param>
998 </xsl:call-template>
999 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
1000 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
1001 -->
1002 <xsl:template name="langfrag">
1003 <xsl:param name="name"/>
1004 <script type="text/javascript">
1005 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
1006 </script>
1007 </xsl:template>
1008
1009
1010 <!-- builds up links to available document types equivalent to the default source
1011 document with as anchor the equivalent documents' doctype icons. -->
1012 <xsl:template name="equivDocLinks">
1013 <xsl:param name="count"/>
1014
1015 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
1016 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
1017
1018 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
1019 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
1020 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
1021 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
1022 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
1023 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
1024 <xsl:variable name="docStartlink">
1025 <xsl:for-each select="metadataList/metadata">
1026 <xsl:if test="contains(@name, 'equivDocLink')">
1027 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
1028 <xsl:if test="not($tmpvar='/')">
1029 <xsl:value-of select="self::node()[@name]"/>
1030 </xsl:if>
1031 </xsl:if>
1032 </xsl:for-each>
1033 </xsl:variable>
1034
1035 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
1036 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
1037 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
1038
1039 <xsl:if test="$equivDocIcon != ''">
1040 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
1041 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
1042 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
1043
1044 <!-- recursively call this template to get multiple entries -->
1045 <xsl:call-template name="equivDocLinks">
1046 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
1047 </xsl:call-template>
1048 </xsl:if>
1049
1050 </xsl:template>
1051
1052 <xsl:template name="expandContractDocumentLinks">
1053 <!--<xsl:if test="count(//documentNode) > 1">-->
1054 <xsl:variable name="doc_url"><xsl:value-of select='$library_name'/>/collection/<xsl:value-of select='/page/pageResponse/collection/@name'/>/document/<xsl:value-of select='/page/pageResponse/document/documentNode/@nodeID'/>?<xsl:if test="/page/pageRequest/paramList/param[@name='p.s']">p.s=<xsl:value-of select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>&amp;</xsl:if></xsl:variable>
1055 <div id="expandContractLinks"><table style="width:100%; text-align:center;"><tr><td><a href="{$doc_url}ed=1"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_doc')"/></a></td><td><a href="javascript:expandOrCollapseAll(false);"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.collapse_doc')"/></a></td></tr></table></div>
1056 <!--</xsl:if>-->
1057 </xsl:template>
1058</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.