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

Last change on this file since 36287 was 36287, checked in by anupama, 22 months ago

PagedImg-e showed up a bug where only the first page of a paged-img document was shown with its img and text. Dr Bainbridge identified the bug as the self-closing div problem and suggested I look at gsf:div definition for solution (if I couldn't use gsf:div itself). Following his Kathy's advice to debug document.xsl by adding AAAA to ZZZZ to each template, I've now found the location(s) that resulted in the self-closing div. Using gsf:div in place of div sufficed to fix the problem.

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