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

Last change on this file since 36971 was 36971, checked in by kjdon, 17 months ago

for group titles and descriptions, now look for displayItems in preference to <title>, <description> <shortDescription>

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