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

Last change on this file since 36634 was 36632, checked in by kjdon, 21 months ago

moved the code for displaying group links in breadcrumbs from about.xsl into gslib, so all pages can use it

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