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

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

dynamically decide on cookie-consent path - use cookie_path if it is set (in servlets.xml) otherwise use servlet_context - set by LibraryServlet in config_params,a nd then passed in to xslt

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