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

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

Make it easier to link in the OAI-PMH server on the home page

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