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

Last change on this file since 35138 was 35138, checked in by davidb, 3 years ago

siteURL XSL variable defined

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