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

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

removed some javascript from gotoFavourites - don't need it, and it wasn't working properly. use xsl variables instead

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