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

Last change on this file was 38830, checked in by kjdon, 6 weeks ago

if we are displaying favourites inside the current collection, then we should also display the groups in hte breadcrumbs. add p.group to the favourites link, and also look for p.group if group param is not present (for groupPath)

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