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

Last change on this file since 34240 was 34240, checked in by ak19, 4 years ago

First bugfix for preserving HTML in collection description. This fixes the bug outside GLI: it was XSLT that was stripping of HTML tags. Massive comments to explain the pitfalls in slightly differing solutions, and why the current one was selected. Also documented links that were instructive and one the mode attribute of apply-templates that when present seems to be safe to use with the most general template (the one that acts on any node/*). After this fix, one problem still remains with HTML tags in collDescription displayItems (outside the additional problems GLI poses). As can be seen when you do o=xml on an appropriately crafted about page, the runtime system shifts to the bottom any text-only content that in collConfig.xml still precedes any HTML that's also inside the coll description. (That is, the non-HTML text appears after the HTML when it occurs before the HTML in the collConfig.xml). The solution for now would be for the user to put such plain text in paragraph tags, so that all the coll description content appears in the order they're in collConfig.xml. In future need to look at what is reordering the text relative to the HTML in such cases.

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