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

Last change on this file since 36943 was 36943, checked in by davidb, 17 months ago

Some scafolding work on support WebSwing version of GLI

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