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

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

Changes so the rightSidebar for query.xsl and classifier.xsl display corrected (float right). The previous approach had been 'bolted' on to the end of displayBaskets was not properly contained within the div that was floated right

File size: 53.4 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 <!--
443 Already defined above as a variable, not sure why if way being defined here again as a 'param'
444 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
445 -->
446 <xsl:param name="pageType"/>
447 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
448 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
449
450<!--
451_httpimages_ {_httpweb_/images}
452_httpscript_ {_httpweb_/script}
453_httpstyle_ {_httpweb_/style}
454_httpflash_ {_httpweb_/flash}
455_httpjava_ {_httpweb_/java}
456-->
457
458
459 <xsl:template name="define-js-variable">
460 <xsl:param name="name"/>
461 <xsl:param name="value"/>
462 <script type="text/javascript">
463 gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
464 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
465 <xsl:value-of select="$value"/>
466 <xslt:text disable-output-escaping="yes">";</xslt:text>
467 </script>
468 </xsl:template>
469
470 <xsl:variable name="_httpcollection_" select="$httpPath"/>
471 <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
472 <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
473
474 <xsl:template name="define-js-macro-variables">
475
476 <xsl:call-template name="define-js-variable">
477 <xsl:with-param name="name" select="'_httpbrowse_'"/>
478 <xsl:with-param name="value" select="$_httpbrowse_"/>
479 </xsl:call-template>
480
481 <xsl:call-template name="define-js-variable">
482 <xsl:with-param name="name" select="'_httpquery_'"/>
483 <xsl:with-param name="value" select="$_httpquery_"/>
484 </xsl:call-template>
485
486 </xsl:template>
487
488
489 <xsl:template name="aboutCollectionPageTitle">
490 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
491 <xsl:value-of select="/page/pageResponse/collection/displayItemList/displayItem[@name='name']"/>
492 <xsl:text> </xsl:text>
493 </xsl:template>
494
495 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
496 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
497 <xsl:choose>
498 <xsl:when test="$this-element/displayItemList/displayItem[@name='icon']">
499 <img border="0">
500 <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>
501 <xsl:attribute name="alt">
502 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
503 </xsl:attribute>
504 <xsl:attribute name="title">
505 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
506 </xsl:attribute>
507 </img>
508 </xsl:when>
509 <xsl:otherwise>
510 <xsl:value-of select="$this-element/displayItemList/displayItem[@name='name']"/>
511 </xsl:otherwise>
512 </xsl:choose>
513 </a>
514 </xsl:template>
515
516 <xsl:template name="homeButtonTop">
517 <a href="{$library_name}?a=p&amp;sa=home">
518 <xsl:attribute name="title">
519 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
520 </xsl:attribute>
521 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
522 </a>
523 </xsl:template>
524
525 <xsl:template name="helpButtonTop">
526 <xsl:choose>
527 <xsl:when test="$pageType='help'">
528 <li>
529 <a>
530 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
531 </a>
532 </li>
533 </xsl:when>
534 <xsl:otherwise>
535 <li>
536 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
537 <xsl:attribute name="title">
538 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
539 </xsl:attribute>
540 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
541 </a>
542 </li>
543 </xsl:otherwise>
544 </xsl:choose>
545 </xsl:template>
546
547 <xsl:template name="preferencesButtonTop">
548 <xsl:choose>
549 <xsl:when test="$pageType='pref'">
550 <li>
551 <a>
552 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
553 </a>
554 </li>
555 </xsl:when>
556 <xsl:otherwise>
557 <li>
558 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
559 <xsl:attribute name="title">
560 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
561 </xsl:attribute>
562 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
563 </a>
564 </li>
565 </xsl:otherwise>
566 </xsl:choose>
567 </xsl:template>
568
569 <xsl:template name="servicesNavigationBar">
570 <xsl:for-each select="$this-element/serviceList/service">
571 <xsl:variable name="action">
572 <xsl:choose>
573 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
574 <xsl:when test="@type='query'">q</xsl:when>
575 <xsl:when test="@type='browse'">b</xsl:when>
576 <xsl:when test="@type='process'">pr</xsl:when>
577 <xsl:when test="@type='applet'">a</xsl:when>
578 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
579 </xsl:choose>
580 </xsl:variable>
581 <xsl:choose>
582 <xsl:when test="$action='CURRENT'">
583 <li>
584 <a>
585 <xsl:value-of select="displayItem[@name='name']"/>
586 </a>
587 </li>
588 </xsl:when>
589 <xsl:when test="$action !='DO_NOT_DISPLAY'">
590 <li>
591 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
592 <xsl:if test="displayItem[@name='description']">
593 <xsl:attribute name="title">
594 <xsl:value-of select="displayItem[@name='description']"/>
595 </xsl:attribute>
596 </xsl:if>
597 <xsl:value-of select="displayItem[@name='name']"/>
598 </a>
599 </li>
600 </xsl:when>
601 </xsl:choose>
602 </xsl:for-each>
603 </xsl:template>
604
605 <xsl:template name="collectionDescriptionTextAndServicesLinks">
606 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
607 </xsl:template>
608
609 <!--
610 Solution to problem where incoming collection description contains HTML and we want to preserve
611 that HTML instead of XML's default behaviour stripping out all tags and just concatenating their text
612 content.
613 The actual solution is here:
614 https://stackoverflow.com/questions/19998180/xsl-copy-nodes-without-xmlns
615 - Close but adds namespacs to the first HTML tag:
616 https://stackoverflow.com/questions/6199345/how-to-copy-all-child-nodes-of-any-type-of-a-template-context-element
617 Other links that are a learning experience:
618 - https://support.microsoft.com/en-us/help/264665/how-to-display-html-in-xsl-style-sheet
619 (tags need to come in in entity form for xslt to remove the entities in output)
620 - https://forums.asp.net/t/1414309.aspx?Decoding+HTML+after+applying+an+XLST+transform+to+an+XML+control
621 (same problem)
622 - https://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html
623 (general information)
624 - https://stackoverflow.com/questions/5876382/using-xslt-to-copy-all-nodes-in-xml-with-support-for-special-cases
625 (close to solution)
626 -->
627 <xsl:template match="collection|serviceCluster">
628 <!-- original way: does not preserve html tags -->
629 <!--<xsl:value-of select="displayItemList/displayItem[@name='description']" disable-output-escaping="yes"/>-->
630 <xsl:apply-templates select="displayItemList/displayItem[@name='description']"/>
631
632 <!-- Don't do this. It seems to remove any text nodes directly within this displayItem
633 before copying only the subdnodes -->
634 <!-- <xsl:apply-templates select="displayItemList/displayItem[@name='description']/*" mode="copy-no-namespaces"/> -->
635
636 <!-- Don't do this: it will also copy the <displayItem> element itself into the HTML output -->
637 <!--<xsl:copy-of select="displayItemList/displayItem[@name='description']"/>-->
638
639 <!-- The other way: requires the input to already be entity encoded for xslt to get it right,
640 to get it ending up as tags in the HTML generated. An example of it working below.
641 But that means we have to get the runtime code to send entity encoded elements, which
642 is not what we want.
643 -->
644 <!--<xsl:text disable-output-escaping="yes">&lt;b&gt;hello&lt;/b&gt;</xsl:text>-->
645
646<!-- Uncomment this section if you want the collection service links and their descriptions to appear -->
647 <!--<xsl:apply-templates select="serviceList">
648 <xsl:with-param name="collName" select="$collName"/>
649 </xsl:apply-templates>-->
650 </xsl:template>
651
652 <!-- preserve any HTML tags *within* the collection description
653 Why is this adding an xmlns namespace to the first HTML tag encountered and converting
654 non html entities like the apostrophe character into their entity forms?
655 This seems to assume entities in the input should be converted:
656 https://stackoverflow.com/questions/31517944/xsl-disable-output-escaping-copy-of
657 But I'm wondering why when there's no entity in the input, copy-of produces entities
658 for chars like apostrophe in the output?
659 Note: there's xsl:copy and xsl:copy-of, we want copy-of!
660 - https://www.w3schools.com/xml/ref_xsl_el_copy.asp
661 - vs https://www.w3schools.com/XML/ref_xsl_el_copy-of.asp
662
663 Info on avoiding doe/disable-output-escaping at https://saxonica.plan.io/issues/3214
664 https://stackoverflow.com/questions/31517944/xsl-disable-output-escaping-copy-of
665 -->
666 <xsl:template match="displayItem[@name='description']">
667 <!-- don't do this: it adds an xmlns namespace to the first/root html element in displayItem -->
668 <!--<xsl:copy-of select="node()"/>-->
669 <xsl:apply-templates select="node()" mode="copy-no-namespaces"/>
670 </xsl:template>
671 <!-- On mode attribute: https://www.w3schools.com/xml/ref_xsl_el_apply-templates.asp
672 https://stackoverflow.com/questions/4486869/can-one-give-me-the-example-for-mode-of-template-in-xsl
673 https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms256045(v=vs.100)?redirectedfrom=MSDN
674 -->
675 <xsl:template match="*" mode="copy-no-namespaces">
676 <xsl:element name="{local-name()}">
677 <xsl:copy-of select="@*"/>
678 <xsl:apply-templates select="node()" mode="copy-no-namespaces"/>
679 </xsl:element>
680 </xsl:template>
681
682 <xsl:template match="comment()| processing-instruction()" mode="copy-no-namespaces">
683 <xsl:copy/>
684 </xsl:template>
685
686 <xsl:template match="serviceList">
687 <xsl:param name="collName"/>
688 <h3>
689 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
690 </h3>
691 <p>
692 <xsl:choose>
693 <xsl:when test="service">
694 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
695 </xsl:when>
696 <xsl:otherwise>
697 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
698 </xsl:otherwise>
699 </xsl:choose>
700 </p>
701 <xsl:if test="service">
702 <div id="servicelist">
703 <xsl:for-each select="service">
704 <xsl:sort select="position()" order="descending" data-type="number"/>
705 <xsl:variable name="action">
706 <xsl:choose>
707 <xsl:when test="@type='query'">q</xsl:when>
708 <xsl:when test="@type='process'">pr</xsl:when>
709 <xsl:when test="@type='applet'">a</xsl:when>
710 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
711 </xsl:choose>
712 </xsl:variable>
713 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
714 <div class="paramLabel">
715 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
716 <xsl:value-of select="displayItem[@name='name']"/>
717 </a>
718 </div>
719 <div class="paramLabel">
720 <xsl:value-of select="displayItem[@name='description']"/>
721 </div>
722 <br class="clear"/>
723 </xsl:if>
724 </xsl:for-each>
725 </div>
726 </xsl:if>
727
728 </xsl:template>
729
730 <!-- classifier page ............................................................................ -->
731 <xsl:template name="collapsedNavigationTab">
732 <xsl:param name="type"/>
733 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
734 <li>
735 <xsl:if test="$isCurrent">
736 <xsl:attribute name="class">current</xsl:attribute>
737 </xsl:if>
738 <a>
739 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
740 <xsl:attribute name="title">
741 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
742 </xsl:attribute>
743 </xsl:if>
744 <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>
745 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
746 </a>
747 </li>
748 </xsl:template>
749
750 <xsl:template name="navigationTab">
751 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
752 <xsl:variable name="action">
753 <xsl:choose>
754 <xsl:when test="@type='query'">q</xsl:when>
755 <xsl:when test="@type='browse'">b</xsl:when>
756 <xsl:when test="@type='process'">pr</xsl:when>
757 <xsl:when test="@type='applet'">a</xsl:when>
758 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
759 </xsl:choose>
760 </xsl:variable>
761 <xsl:if test="$action!='DO_NOT_DISPLAY'">
762 <li>
763 <xsl:if test="$isCurrent">
764 <xsl:attribute name="class">current</xsl:attribute>
765 </xsl:if>
766 <a>
767 <xsl:if test="displayItem[@name='description']">
768 <xsl:attribute name="title">
769 <xsl:value-of select="displayItem[@name='description']"/>
770 </xsl:attribute>
771 </xsl:if>
772 <xsl:choose>
773 <xsl:when test="classifierList/classifier/@name">
774 <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>
775 </xsl:when>
776 <xsl:otherwise>
777 <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>
778 </xsl:otherwise>
779 </xsl:choose>
780 <xsl:value-of select="displayItem[@name='name']"/>
781 </a>
782 </li>
783 </xsl:if>
784 </xsl:template>
785
786 <xsl:template name="classifierLink">
787 <xsl:if test="@name=/page/pageResponse/classifier/@name">
788 <xsl:attribute name="class">current</xsl:attribute>
789 </xsl:if>
790 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
791 <xsl:value-of select="displayItem[@name='description']"/>
792 </a>
793 </xsl:template>
794
795 <!-- query page ............................................................................ -->
796<!-- <xsl:template name="indexName">
797 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
798 </xsl:template>
799
800 <xsl:template name="queryPageCollectionName">
801 <xsl:choose>
802 <xsl:when test="/page/pageResponse/collection">
803 <gslib:aboutCollectionPageTitle/>
804 </xsl:when>
805 <xsl:otherwise>Cross-Collection</xsl:otherwise>
806 </xsl:choose>
807 </xsl:template>-->
808
809 <!--
810BERRY BASKET TEMPLATES
811These get used on many different pages to add the
812berry basket function to the site
813 -->
814
815 <xsl:template name="displayBaskets">
816 <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)))">
817
818 <xsl:if test="$berryBasketOn">
819 <!-- show the berry basket if it's turned on -->
820 <gslib:berryBasket/>
821 <xsl:text> </xsl:text>
822 </xsl:if>
823
824 <xsl:if test="$favouriteBasketOn">
825 <!-- show the favourites 'basket' if it's turned on -->
826 <gslib:gotoFavourites/>
827 <xsl:text> </xsl:text>
828 </xsl:if>
829
830 <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))">
831 <!-- show the document basket if its turned on and the user has permission-->
832 <gslib:documentBasket/>
833 <xsl:text> </xsl:text>
834 </xsl:if>
835 </xsl:if>
836 </xsl:template>
837
838 <!-- put the drag&drop berry basket on the page -->
839 <xsl:template name="berryBasket">
840 <xsl:if test="$berryBasketOn">
841 <div id="berrybasket" class="hide">
842 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.title')"/><xsl:text> </xsl:text></span>
843 <span id="berryBasketExpandCollapseLinks" style="display: none;">
844 <a id="berryBasketExpandLink" href="javascript:showBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
845 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
846 </span>
847 <div id="baskethandle">
848 <span>
849 <xsl:text> </xsl:text>
850 </span>
851 </div>
852 <div id="berries">
853 <span>
854 <xsl:text> </xsl:text>
855 </span>
856 </div>
857 <div><a id="berryFullViewLink" style="display: none;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.full')"/></a></div>
858 <div id="berryHelpMsg"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.help')"/></div>
859 </div>
860
861 </xsl:if>
862 </xsl:template>
863
864 <!--
865 Goto Favourites Template
866 This gets used on many different pages to add the
867 goto favourites check-out functionality to the site
868 -->
869 <xsl:template name="gotoFavourites">
870 <!-- set up these gsf variables so we have access in javascript -->
871 <gsf:variable name="selected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$selected_favourite_icon"/></gsf:variable>
872 <gsf:variable name="unselected_favourite_icon_url">interfaces/<xsl:value-of select="$interface_name"/>/images/<xsl:value-of select="$unselected_favourite_icon"/></gsf:variable>
873 <xsl:if test="$favouriteBasketOn">
874 <div id="berrybasket" class="hide">
875 <img src="interfaces/{$interface_name}/images/{$selected_favourite_icon}" title="click to add to favourites" width="16" height="16" border="0" />
876 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'favourites.title')"/><xsl:text> </xsl:text></span>
877 <span id="favouritesCountDisplay">...</span>
878
879 <div><a id="favouritesFullViewLink" style="display: block;"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'berry.full')"/></a></div>
880 </div>
881 <gsf:script>
882 //set url and show full view link
883 var fullView = YAHOO.util.Dom.get('favouritesFullViewLink');
884 //Find the collection in the cgi parameters
885 var url = window.location.href;
886 var colstart = url.indexOf("&amp;c=");
887 var collectionName = "";
888 if (colstart != -1)
889 {
890 var colend = url.indexOf("&amp;", (colstart + 1));
891 if (colend == -1)
892 {
893 colend = url.length - 1;
894 }
895 collectionName = url.substring(colstart + 3, colend);
896 }
897
898 fullView.setAttribute("href",gs.xsltParams.library_name + "?a=g&amp;sa=berry&amp;c=&amp;s=DisplayList&amp;rt=r&amp;p.c=" + collectionName);
899 fullView.style.display='block';
900
901 </gsf:script>
902 </xsl:if>
903 </xsl:template>
904
905
906
907
908 <!-- put the drag&drop document basket on the page -->
909 <xsl:template name="documentBasket">
910 <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))">
911 <div id="documentbasket" class="hide">
912 <span><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'db.doc_basket')"/><xsl:text> </xsl:text></span>
913 <span id="documentBasketExpandCollapseLinks" style="display: none;">
914 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.expand')"/></a>
915 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.collapse')"/></a>
916 </span>
917 <div id="documenthandle">
918 <span>
919 <xsl:text> </xsl:text>
920 </span>
921 </div>
922 <div id="documentpages">
923 <span>
924 <xsl:text> </xsl:text>
925 </span>
926 </div>
927 <div>
928 <a href="javascript:clearBasket();"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'basket.clear')"/></a>
929 </div>
930 </div>
931 </xsl:if>
932 </xsl:template>
933
934 <!-- include the required javascript and css for berry baskets -->
935 <xsl:template name="basketHeadTags">
936 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
937 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
938 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
939 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
940 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
941 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
942 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
943 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berryvariables.js"><xsl:text> </xsl:text></script>
944 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
945 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
946 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
947 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
948
949 <!-- Combo-handled YUI CSS files: -->
950 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
951
952 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
953 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
954 <!-- Combo-handled YUI JS files: -->
955 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
956 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
957 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
958 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
959 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
960 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
961 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
962 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
963 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
964 </xsl:template>
965
966 <!--
967create a little berry which can be drag&dropped onto the berry basket
968used on classifier and search result pages
969-->
970 <xsl:template name="documentBerryForClassifierOrSearchPage">
971 <xsl:if test="$berryBasketOn">
972 <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>
973 <img class="pick" src="interfaces/{$interface_name}/images/{$berry_icon}" alt="in basket" width="15" height="15" border="0">
974 <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
975 </img>
976 </xsl:if>
977 </xsl:template>
978
979
980 <xsl:template name="documentFavouriteForClassifierOrSearchPage">
981 <xsl:if test="$favouriteBasketOn">
982 <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>
983 <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">
984 <xsl:attribute name="id"><xsl:value-of select="$collname"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
985 </img>
986 </xsl:if>
987 </xsl:template>
988
989 <!--
990create little berrys which can be drag&dropped onto the berry basket
991used on the document page
992-->
993 <xsl:template name="documentBerryForDocumentPage">
994 <xsl:variable name="selectedNode">
995 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
996 </xsl:variable>
997 <xsl:variable name="rootNode">
998 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
999 </xsl:variable>
1000 <xsl:if test="$berryBasketOn">
1001 <div id="documentberries">
1002 <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"/>
1003 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
1004 <!--<xsl:if test="$selectedNode != $rootNode">
1005 <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"/>
1006 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
1007 </xsl:if>-->
1008 </div>
1009 </xsl:if>
1010 </xsl:template>
1011
1012 <xsl:template name="documentFavouriteForDocumentPage">
1013 <xsl:variable name="selectedNode">
1014 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
1015 </xsl:variable>
1016 <xsl:variable name="rootNode">
1017 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
1018 </xsl:variable>
1019 <xsl:if test="$favouriteBasketOn">
1020 <div id="documentberries">
1021 <img id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/{$unselected_favourite_icon}" alt="in basket" width="15" height="15" border="0"/>
1022 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
1023 <!--<xsl:if test="$selectedNode != $rootNode">
1024 <img id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/{$berry_icon}" alt="in basket" width="15" height="15" border="0"/>
1025 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
1026 </xsl:if>-->
1027 </div>
1028 </xsl:if>
1029 </xsl:template>
1030
1031 <!-- document page -->
1032 <xsl:template name="documentTitle">
1033 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
1034 </xsl:template>
1035 <xsl:template name="coverImage">
1036 <img>
1037 <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>
1038 </img>
1039 </xsl:template>
1040
1041 <xsl:template name="previousNextButtons">
1042 <!-- prev -->
1043 <a>
1044 <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>
1045 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
1046 </a>
1047 <!-- next -->
1048 <a>
1049 <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>
1050 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
1051 </a>
1052 </xsl:template>
1053
1054
1055 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
1056 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
1057 <xsl:call-template name="langfrag">
1058 <xsl:with-param name="name">dse</xsl:with-param>
1059 </xsl:call-template>
1060 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
1061 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
1062 -->
1063 <xsl:template name="langfrag">
1064 <xsl:param name="name"/>
1065 <script type="text/javascript">
1066 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
1067 </script>
1068 </xsl:template>
1069
1070
1071 <!-- builds up links to available document types equivalent to the default source
1072 document with as anchor the equivalent documents' doctype icons. -->
1073 <xsl:template name="equivDocLinks">
1074 <xsl:param name="count"/>
1075
1076 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
1077 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
1078
1079 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
1080 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
1081 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
1082 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
1083 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
1084 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
1085 <xsl:variable name="docStartlink">
1086 <xsl:for-each select="metadataList/metadata">
1087 <xsl:if test="contains(@name, 'equivDocLink')">
1088 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
1089 <xsl:if test="not($tmpvar='/')">
1090 <xsl:value-of select="self::node()[@name]"/>
1091 </xsl:if>
1092 </xsl:if>
1093 </xsl:for-each>
1094 </xsl:variable>
1095
1096 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
1097 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
1098 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
1099
1100 <xsl:if test="$equivDocIcon != ''">
1101 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
1102 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
1103 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
1104
1105 <!-- recursively call this template to get multiple entries -->
1106 <xsl:call-template name="equivDocLinks">
1107 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
1108 </xsl:call-template>
1109 </xsl:if>
1110
1111 </xsl:template>
1112
1113 <xsl:template name="expandContractDocumentLinks">
1114 <!--<xsl:if test="count(//documentNode) > 1">-->
1115 <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>
1116 <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>
1117 <!--</xsl:if>-->
1118 </xsl:template>
1119</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.