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

Last change on this file since 37521 was 37521, checked in by kjdon, 14 months ago

favourites now uses new gdl action. and service names are changed to mention Favourites.

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