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

Last change on this file since 27087 was 27087, checked in by ak19, 11 years ago

Implemented RSS support for GS3. At present, can see this with a=rss in the url, when a collection is built. Soon will have a button (at least for the GS3 demo collection).

File size: 34.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
5 xmlns:gslib="http://www.greenstone.org/XSL/Library"
6 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7 xmlns:util="http://org.greenstone.gsdl3.util.XSLTUtil"
8 exclude-result-prefixes="util xalan gslib gsf xslt">
9
10
11 <!-- force lower priority on xsl:output, so other files like rss.xsl can override with their own xsl:output stmt
12 If other files don't specify any, gslib.xsl specifies html output as default and defines a loose DOCTYPE for it. -->
13 <xsl:import href="html-output.xsl" />
14
15 <xsl:include href="xml-to-string.xsl"/>
16
17 <!-- some global parameters - these are set by whoever is invoking the transformation -->
18 <xsl:param name="interface_name"/>
19 <xsl:param name="library_name"/>
20 <xsl:param name="site_name"/>
21 <!-- every pages ....................................................................... -->
22
23 <xsl:template name="siteName">
24 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='siteName']"/>
25 </xsl:template>
26
27 <xsl:template name="siteLink">
28 <a href="./{$library_name}">
29 <xsl:call-template name="siteName"/>
30 </a>
31 <xsl:text> </xsl:text>
32 </xsl:template>
33
34 <xsl:variable name="a">
35 <xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/>
36 </xsl:variable>
37
38 <xsl:variable name="collections" select="/page/pageResponse/collectionList/collection"/>
39
40 <xsl:variable name="berrybasketswitch">
41 <xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/>
42 </xsl:variable>
43
44 <xsl:variable name="berryBasketOn" select="/page/pageRequest/paramList/param[@name='berrybasket' and @value='on']"/>
45 <xsl:variable name="documentBasketOn" select="/page/pageRequest/paramList/param[@name='documentbasket' and @value='on']"/>
46
47 <xsl:variable name="thisCollectionEditor">
48 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 'c']/@value"/>
49 <xsl:text>-collection-editor</xsl:text>
50 </xsl:variable>
51
52 <!-- template to get the name of the current collection -->
53 <xsl:template name="collectionName">
54 <xsl:choose>
55 <xsl:when test="/page/pageResponse/collection">
56 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
57 </xsl:when>
58 <xsl:otherwise>All Collections</xsl:otherwise>
59 </xsl:choose>
60 </xsl:template>
61
62 <xsl:template name="collectionNameShort">
63 <xsl:value-of select="/page/pageResponse/collection/@name"/>
64 </xsl:template>
65 <xsl:template name="collectionNameLinked">
66 <xsl:if test="/page/pageResponse/collection">
67 <a>
68 <xsl:attribute name="href">./<xsl:value-of select="$library_name"/>/collection/<xsl:call-template name="collectionNameShort"/>/page/about</xsl:attribute>
69 <xsl:call-template name="collectionName"/>
70 </a>
71 </xsl:if>
72 </xsl:template>
73
74 <!-- text to get the name of the current service ("Browse","Search" etc) -->
75 <xsl:template name="serviceName">
76 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
77 </xsl:template>
78
79 <xsl:template name="textDirectionAttribute">
80 <xsl:attribute name="dir">
81 <xsl:choose>
82 <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>
83 <xsl:otherwise>ltr</xsl:otherwise>
84 </xsl:choose>
85 </xsl:attribute>
86 </xsl:template>
87
88 <xsl:template name="actionClass">
89 <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>
90 </xsl:template>
91 <!-- username, if logged in -->
92 <!--
93 <xsl:template name="username">
94 <xsl:if test="$un_s!=''">
95 <xsl:if test="$asn!='' and $asn!='0'">
96 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.username')"/> : <xsl:value-of select="$un_s"/>
97 </xsl:if>
98 </xsl:if>
99 </xsl:template>
100 -->
101 <xsl:template name="defaultDividerBar">
102 <xsl:param name="text"/>
103 <xsl:choose>
104 <xsl:when test="$text">
105 <div class="divbar">
106 <xsl:value-of select="$text"/>
107 </div>
108 </xsl:when>
109 <xsl:otherwise>
110 <div class="divbar">
111 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
112 </div>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:template>
116
117 <xsl:template match="error">
118 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'error')"/> <xsl:value-of select="."/>
119 </xsl:template>
120 <xsl:template name="displayErrorsIfAny">
121 <xsl:if test="descendant::error">
122 <script language="Javascript">
123 <xsl:text disable-output-escaping="yes">
124 function removeAllChildren(node) {
125 while (node.hasChildNodes()) {
126 node.removeChild(node.firstChild);
127 }
128 }
129
130 function toggleHideError(obj) {
131 if (obj.style.display == "none") {
132 obj.style.display = "";
133 hide_link = document.getElementById("hide");
134 removeAllChildren(hide_link);
135 hide_link.appendChild(document.createTextNode("</xsl:text>
136 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'hide_error')"/>
137 <xsl:text disable-output-escaping="yes">"));
138 } else {
139 obj.style.display = "none";
140 hide_link = document.getElementById("hide");
141 removeAllChildren(hide_link);
142 hide_link.appendChild(document.createTextNode("</xsl:text>
143 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
144 <xsl:text disable-output-escaping="yes">"));
145 }
146 }
147 </xsl:text>
148 </script>
149 <p align="right">
150 <a id="hide" href="javascript:toggleHideError(error);">
151 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'show_error')"/>
152 </a>
153 </p>
154 <div id="error" style="display: none;">
155 <xsl:apply-templates select="descendant::error"/>
156 </div>
157 </xsl:if>
158 </xsl:template>
159
160 <xsl:template name="noTextBar">
161 <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
162 </xsl:template>
163
164 <xsl:template name="poweredByGS3TextBar">
165 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/>
166 </xsl:template>
167
168 <xsl:template name="rightArrow">
169 <xsl:text disable-output-escaping="yes"> &amp;raquo; </xsl:text>
170 </xsl:template>
171
172 <!-- site home ....................................................................... -->
173 <xsl:template name="siteHomePageTitle">
174 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
175 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
176 <xsl:text> </xsl:text>
177 </xsl:template>
178
179 <xsl:template name="selectACollectionTextBar">
180 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.select_a_collection')"/>
181 </xsl:template>
182
183 <xsl:template name="crossCollectionQuickSearchForm">
184 <xsl:apply-templates select="serviceList/service[@name='TextQuery']"/>
185 </xsl:template>
186
187 <xsl:template match="service[@name='TextQuery']">
188 <form name="QuickSearch" method="get" action="{$library_name}">
189 <input type="hidden" name="a" value="q"/>
190 <input type="hidden" name="rt" value="rd"/>
191 <input type="hidden" name="s" value="{@name}"/>
192 <input type="hidden" name="s1.collection" value="all"/>
193 <input type="text" name="s1.query" size="20"/>
194 <input type="submit">
195 <xsl:attribute name="value">
196 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.quick_search')"/>
197 </xsl:attribute>
198 </input>
199 </form>
200 </xsl:template>
201
202 <xsl:template name="collectionLinkWithImage">
203 <xsl:variable name="desc"><xsl:value-of select="displayItem[@name='shortDescription']"/></xsl:variable>
204 <xsl:variable name="coll_href"><xsl:value-of select="$library_name"/>/collection/<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>
205 <xsl:choose>
206 <xsl:when test="displayItem[@name='icon']">
207 <a href="{$coll_href}" title="{$desc}">
208 <img class="collectionLinkImage">
209 <xsl:attribute name="alt"><xsl:value-of select="displayItem[@name='name']"/></xsl:attribute>
210 <xsl:attribute name="src">sites/<xsl:value-of select="$site_name"/>/collect/<xsl:value-of select="@name"/>/images/<xsl:value-of select="displayItem[@name='icon']"/></xsl:attribute>
211 </img>
212 </a>
213 </xsl:when>
214 <xsl:otherwise>
215 <a href="{$coll_href}" title="{$desc}">
216 <div class="collectionLink">
217 <xsl:value-of select="displayItem[@name='name']"/>
218 </div>
219 </a>
220 </xsl:otherwise>
221 </xsl:choose>
222 </xsl:template>
223
224 <xsl:template name="serviceClusterList">
225 <xsl:apply-templates select="serviceClusterList"/>
226 </xsl:template>
227
228 <xsl:template match="serviceClusterList">
229 <xsl:for-each select="serviceCluster">
230 <a href="{$library_name}?a=p&amp;sa=about&amp;c={@name}">
231 <xsl:value-of select="@name"/>
232 <xsl:value-of select="displayItem[@name='name']"/>
233 </a>
234 </xsl:for-each>
235 </xsl:template>
236
237 <xsl:template name="serviceLink">
238 <div class="paramLabel">
239 <a href="{$library_name}?a=q&amp;rt=d&amp;s={@name}">
240 <xsl:value-of select="displayItem[@name='name']"/>
241 </a>
242 </div>
243 <div class="paramValue">
244 <xsl:value-of select="displayItem[@name='description']"/>
245 </div>
246 <br class="clear"/>
247 </xsl:template>
248
249 <xsl:template name="authenticationLink">
250 <xsl:for-each select="//serviceList/service[@type='authen']">
251 <div class="paramLabel">
252 <a href="{$library_name}/admin/ListUsers">
253 <xsl:value-of select="displayItem[@name='name']"/>
254 </a>
255 </div>
256 <div class="paramValue">
257 <xsl:value-of select="displayItem[@name='description']"/>
258 </div>
259 </xsl:for-each>
260 </xsl:template>
261
262 <xsl:template name="registerLink">
263 <xsl:for-each select="//serviceList/service[@type='authen']">
264 <div class="paramLabel">
265 <a href="{$library_name}/admin/Register">
266 <xsl:text>Register</xsl:text>
267 </a>
268 </div>
269 <div class="paramValue">
270 <xsl:text>Register as a new user</xsl:text>
271 </div>
272 </xsl:for-each>
273 </xsl:template>
274
275 <xsl:template name="libraryInterfaceLink">
276 <li>
277 <a href="{$library_name}?a=p&amp;sa=gli4gs3">
278 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home.librarian_interface')"/>
279 </a>
280 </li>
281 </xsl:template>
282
283 <xsl:template name="greenstoneLogoAlternateText">
284 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/>
285 </xsl:template>
286
287 <!-- about page - collection home ....................................................................... -->
288 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
289 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
290 <xsl:variable name="siteName" select="$site_name"/>
291 <xsl:param name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
292 <xsl:param name="pageType"/>
293 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
294 <xsl:variable name="this-service" select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
295
296<!--
297_httpimages_ {_httpweb_/images}
298_httpscript_ {_httpweb_/script}
299_httpstyle_ {_httpweb_/style}
300_httpflash_ {_httpweb_/flash}
301_httpjava_ {_httpweb_/java}
302-->
303
304
305 <xsl:template name="define-js-variable">
306 <xsl:param name="name"/>
307 <xsl:param name="value"/>
308 <script type="text/javascript">
309 gs.variables[<xslt:text disable-output-escaping="yes">"</xslt:text><xsl:value-of select="$name"/><xslt:text disable-output-escaping="yes">"</xslt:text>]
310 <xslt:text disable-output-escaping="yes"> = "</xslt:text>
311 <xsl:value-of select="$value"/>
312 <xslt:text disable-output-escaping="yes">";</xslt:text>
313 </script>
314 </xsl:template>
315
316 <xsl:variable name="_httpcollection_" select="$httpPath"/>
317 <xsl:variable name="_httpbrowse_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/browse</xsl:variable>
318 <xsl:variable name="_httpquery_"><xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/search</xsl:variable>
319
320 <xsl:template name="define-js-macro-variables">
321
322 <xsl:call-template name="define-js-variable">
323 <xsl:with-param name="name" select="'_httpbrowse_'"/>
324 <xsl:with-param name="value" select="$_httpbrowse_"/>
325 </xsl:call-template>
326
327 <xsl:call-template name="define-js-variable">
328 <xsl:with-param name="name" select="'_httpquery_'"/>
329 <xsl:with-param name="value" select="$_httpquery_"/>
330 </xsl:call-template>
331
332 </xsl:template>
333
334
335 <xsl:template name="aboutCollectionPageTitle">
336 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
337 <xsl:value-of select="/page/pageResponse/collection/displayItem[@name='name']"/>
338 <xsl:text> </xsl:text>
339 </xsl:template>
340
341 <xsl:template name="collectionHomeLinkWithLogoIfAvailable">
342 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
343 <xsl:choose>
344 <xsl:when test="$this-element/displayItem[@name='icon']">
345 <img border="0">
346 <xsl:attribute name="src"><xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/></xsl:attribute>
347 <xsl:attribute name="alt">
348 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
349 </xsl:attribute>
350 <xsl:attribute name="title">
351 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
352 </xsl:attribute>
353 </img>
354 </xsl:when>
355 <xsl:otherwise>
356 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
357 </xsl:otherwise>
358 </xsl:choose>
359 </a>
360 </xsl:template>
361
362 <xsl:template name="homeButtonTop">
363 <a href="{$library_name}?a=p&amp;sa=home">
364 <xsl:attribute name="title">
365 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/>
366 </xsl:attribute>
367 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
368 </a>
369 </xsl:template>
370
371 <xsl:template name="helpButtonTop">
372 <xsl:choose>
373 <xsl:when test="$pageType='help'">
374 <li>
375 <a>
376 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
377 </a>
378 </li>
379 </xsl:when>
380 <xsl:otherwise>
381 <li>
382 <a href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}">
383 <xsl:attribute name="title">
384 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/>
385 </xsl:attribute>
386 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
387 </a>
388 </li>
389 </xsl:otherwise>
390 </xsl:choose>
391 </xsl:template>
392
393 <xsl:template name="preferencesButtonTop">
394 <xsl:choose>
395 <xsl:when test="$pageType='pref'">
396 <li>
397 <a>
398 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
399 </a>
400 </li>
401 </xsl:when>
402 <xsl:otherwise>
403 <li>
404 <a href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}">
405 <xsl:attribute name="title">
406 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/>
407 </xsl:attribute>
408 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
409 </a>
410 </li>
411 </xsl:otherwise>
412 </xsl:choose>
413 </xsl:template>
414
415 <xsl:template name="servicesNavigationBar">
416 <xsl:for-each select="$this-element/serviceList/service">
417 <xsl:variable name="action">
418 <xsl:choose>
419 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
420 <xsl:when test="@type='query'">q</xsl:when>
421 <xsl:when test="@type='browse'">b</xsl:when>
422 <xsl:when test="@type='process'">pr</xsl:when>
423 <xsl:when test="@type='applet'">a</xsl:when>
424 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
425 </xsl:choose>
426 </xsl:variable>
427 <xsl:choose>
428 <xsl:when test="$action='CURRENT'">
429 <li>
430 <a>
431 <xsl:value-of select="displayItem[@name='name']"/>
432 </a>
433 </li>
434 </xsl:when>
435 <xsl:when test="$action !='DO_NOT_DISPLAY'">
436 <li>
437 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
438 <xsl:if test="displayItem[@name='description']">
439 <xsl:attribute name="title">
440 <xsl:value-of select="displayItem[@name='description']"/>
441 </xsl:attribute>
442 </xsl:if>
443 <xsl:value-of select="displayItem[@name='name']"/>
444 </a>
445 </li>
446 </xsl:when>
447 </xsl:choose>
448 </xsl:for-each>
449 </xsl:template>
450
451 <xsl:template name="collectionDescriptionTextAndServicesLinks">
452 <xsl:apply-templates select="pageResponse/collection|serviceCluster"/>
453 </xsl:template>
454 <xsl:template match="collection|serviceCluster">
455 <xsl:value-of select="displayItem[@name='description']" disable-output-escaping="yes"/>
456 <xsl:apply-templates select="serviceList">
457 <xsl:with-param name="collName" select="$collName"/>
458 </xsl:apply-templates>
459 </xsl:template>
460
461 <xsl:template match="serviceList">
462 <xsl:param name="collName"/>
463 <xsl:if test="service[not(@type = 'query' or @type = 'browse' or @type = 'retrieve' or @type = 'oai')]">
464 <h3>
465 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.services')"/>
466 </h3>
467 <p>
468 <xsl:choose>
469 <xsl:when test="service">
470 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.servicehelp')"/>
471 </xsl:when>
472 <xsl:otherwise>
473 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about.noservices')"/>
474 </xsl:otherwise>
475 </xsl:choose>
476 </p>
477 <xsl:if test="service">
478 <div id="servicelist">
479 <xsl:for-each select="service">
480 <xsl:sort select="position()" order="descending" data-type="number"/>
481 <xsl:variable name="action">
482 <xsl:choose>
483 <xsl:when test="@type='query'">q</xsl:when>
484 <xsl:when test="@type='browse'">b</xsl:when>
485 <xsl:when test="@type='process'">pr</xsl:when>
486 <xsl:when test="@type='applet'">a</xsl:when>
487 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
488 </xsl:choose>
489 </xsl:variable>
490 <xsl:if test="$action != 'DO_NOT_DISPLAY'">
491 <div class="paramLabel">
492 <a href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}">
493 <xsl:value-of select="displayItem[@name='name']"/>
494 </a>
495 </div>
496 <div class="paramLabel">
497 <xsl:value-of select="displayItem[@name='description']"/>
498 </div>
499 <br class="clear"/>
500 </xsl:if>
501 </xsl:for-each>
502 </div>
503 </xsl:if>
504 </xsl:if>
505 </xsl:template>
506
507 <!-- classifier page ............................................................................ -->
508 <xsl:template name="collapsedNavigationTab">
509 <xsl:param name="type"/>
510 <xsl:variable name="isCurrent" select="/page/pageResponse/service[@type=$type]"/>
511 <li>
512 <xsl:if test="$isCurrent">
513 <xsl:attribute name="class">current</xsl:attribute>
514 </xsl:if>
515 <a>
516 <xsl:if test="service[@name=$type]/displayItem[@name='description']">
517 <xsl:attribute name="title">
518 <xsl:value-of select="service[@name=$type]/displayItem[@name='description']"/>
519 </xsl:attribute>
520 </xsl:if>
521 <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>
522 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, $type)"/>
523 </a>
524 </li>
525 </xsl:template>
526
527 <xsl:template name="navigationTab">
528 <xsl:variable name="isCurrent" select="@name=/page/pageResponse/service/@name"/>
529 <xsl:variable name="action">
530 <xsl:choose>
531 <xsl:when test="@type='query'">q</xsl:when>
532 <xsl:when test="@type='browse'">b</xsl:when>
533 <xsl:when test="@type='process'">pr</xsl:when>
534 <xsl:when test="@type='applet'">a</xsl:when>
535 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
536 </xsl:choose>
537 </xsl:variable>
538 <xsl:if test="$action!='DO_NOT_DISPLAY'">
539 <li>
540 <xsl:if test="$isCurrent">
541 <xsl:attribute name="class">current</xsl:attribute>
542 </xsl:if>
543 <a>
544 <xsl:if test="displayItem[@name='description']">
545 <xsl:attribute name="title">
546 <xsl:value-of select="displayItem[@name='description']"/>
547 </xsl:attribute>
548 </xsl:if>
549 <xsl:choose>
550 <xsl:when test="classifierList/classifier/@name">
551 <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>
552 </xsl:when>
553 <xsl:otherwise>
554 <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>
555 </xsl:otherwise>
556 </xsl:choose>
557 <xsl:value-of select="displayItem[@name='name']"/>
558 </a>
559 </li>
560 </xsl:if>
561 </xsl:template>
562
563 <xsl:template name="classifierLink">
564 <xsl:if test="@name=/page/pageResponse/classifier/@name">
565 <xsl:attribute name="class">current</xsl:attribute>
566 </xsl:if>
567 <a href="{$library_name}?a=b&amp;rt=r&amp;s={/page/pageResponse/service/@name}&amp;c={/page/pageResponse/collection/@name}&amp;cl={@name}">
568 <xsl:value-of select="displayItem[@name='description']"/>
569 </a>
570 </xsl:template>
571
572 <!-- query page ............................................................................ -->
573 <xsl:template name="indexName">
574 <xsl:value-of select="/page/pageResponse/service/displayItem[@name='name']"/>
575 </xsl:template>
576 <xsl:template name="queryPageCollectionName">
577 <xsl:choose>
578 <xsl:when test="/page/pageResponse/collection">
579 <gslib:aboutCollectionPageTitle/>
580 </xsl:when>
581 <xsl:otherwise>Cross-Collection</xsl:otherwise>
582 </xsl:choose>
583 </xsl:template>
584
585 <!--
586BERRY BASKET TEMPLATES
587These get used on many different pages to add the
588berry basket function to the site
589-->
590 <!-- put the drag&drop berry basket on the page -->
591 <xsl:template name="berryBasket">
592 <xsl:if test="$berryBasketOn">
593 <div id="berrybasket" class="hide">
594 <span>Berry Basket</span>
595 <span id="berryBasketExpandCollapseLinks" style="display: none;">
596 <a id="berryBasketExpandLink" href="javascript:showBasket()">Expand</a>
597 <a id="berryBasketCollapseLink" style="display: none;" href="javascript:hideBasket()">Collapse</a>
598 </span>
599 <div id="baskethandle">
600 <span>
601 <xsl:text> </xsl:text>
602 </span>
603 </div>
604 <div id="berries">
605 <span>
606 <xsl:text> </xsl:text>
607 </span>
608 </div>
609 </div>
610 </xsl:if>
611 </xsl:template>
612
613 <!-- put the drag&drop document basket on the page -->
614 <xsl:template name="documentBasket">
615 <xsl:if test="$documentBasketOn and /page/pageRequest/userInformation 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))">
616 <div id="documentbasket" class="hide">
617 <span>Document Basket</span>
618 <span id="documentBasketExpandCollapseLinks" style="display: none;">
619 <a id="documentBasketExpandLink" href="javascript:showDocumentBox()">Expand</a>
620 <a id="documentBasketCollapseLink" style="display: none;" href="javascript:hideDocumentBox()">Collapse</a>
621 </span>
622 <div id="documenthandle">
623 <span>
624 <xsl:text> </xsl:text>
625 </span>
626 </div>
627 <div id="documentpages">
628 <span>
629 <xsl:text> </xsl:text>
630 </span>
631 </div>
632 <div>
633 <a href="javascript:clearBasket();">Clear basket</a>
634 </div>
635 </div>
636 </xsl:if>
637 </xsl:template>
638
639 <!-- include the required javascript and css for berry baskets -->
640 <xsl:template name="berryBasketHeadTags">
641 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/yahoo-min.js"><xsl:text> </xsl:text></script>
642 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/event-min.js"><xsl:text> </xsl:text></script>
643 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/connection-min.js"><xsl:text> </xsl:text></script>
644 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dom-min.js"><xsl:text> </xsl:text></script>
645 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/dragdrop-min.js"><xsl:text> </xsl:text></script>
646 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/cookie-min.js"><xsl:text> </xsl:text></script>
647 <script type="text/javascript" src="interfaces/{$interface_name}/js/yui/animation-min.js"><xsl:text> </xsl:text></script>
648
649 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDPlayer.js"><xsl:text> </xsl:text></script>
650 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/ygDDOnTop.js"><xsl:text> </xsl:text></script>
651 <script type="text/javascript" src="interfaces/{$interface_name}/js/berrybasket/berrybasket.js"><xsl:text> </xsl:text></script>
652 <link rel="stylesheet" href="interfaces/{$interface_name}/style/berry.css" type="text/css"/>
653
654 <!-- Combo-handled YUI CSS files: -->
655 <link rel="stylesheet" type="text/css" href="interfaces/{$interface_name}/style/skin.css"/>
656
657 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentbasket.js"><xsl:text> </xsl:text></script>
658 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/documentBasketDragDrop.js"><xsl:text> </xsl:text></script>
659 <!-- Combo-handled YUI JS files: -->
660 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yahoo-dom-event.js"><xsl:text> </xsl:text></script>
661 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/container_core-min.js"><xsl:text> </xsl:text></script>
662 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/element-min.js"><xsl:text> </xsl:text></script>
663 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/menu-min.js"><xsl:text> </xsl:text></script>
664 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/button-min.js"><xsl:text> </xsl:text></script>
665 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-min.js"><xsl:text> </xsl:text></script>
666 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/yuiloader-min.js"><xsl:text> </xsl:text></script>
667 <!--<script type="text/javascript" src="interfaces/{$interface_name}/js/documentbasket/editor-dialog.js"><xsl:text> </xsl:text></script>-->
668
669 <link rel="stylesheet" href="interfaces/{$interface_name}/style/documentbasket.css" type="text/css"/>
670 </xsl:template>
671
672 <!--
673create a little berry which can be drag&dropped onto the berry basket
674used on classifier and search result pages
675-->
676 <xsl:template name="documentBerryForClassifierOrSearchPage">
677 <xsl:if test="$berryBasketOn">
678 <img class="pick" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0">
679 <xsl:attribute name="id"><xsl:value-of select="/page/pageResponse/collection/@name"/>:<xsl:value-of select="@nodeID"/></xsl:attribute>
680 </img>
681 </xsl:if>
682 </xsl:template>
683
684 <!--
685create little berrys which can be drag&dropped onto the berry basket
686used on the document page
687-->
688 <xsl:template name="documentBerryForDocumentPage">
689 <xsl:variable name="selectedNode">
690 <xsl:value-of select="/page/pageResponse/document/@selectedNode"/>
691 </xsl:variable>
692 <xsl:variable name="rootNode">
693 <xsl:value-of select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
694 </xsl:variable>
695 <xsl:if test="$berryBasketOn">
696 <div id="documentberries">
697 <img class="pick" id="{/page/pageResponse/collection/@name}:{$rootNode}" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0"/>
698 <span id="{/page/pageResponse/collection/@name}:{$rootNode}:root" class="documentberry">the whole document</span>
699 <!--<xsl:if test="$selectedNode != $rootNode">
700 <img class="pick" id="{/page/pageResponse/collection/@name}:{$selectedNode}" src="interfaces/{$interface_name}/images/berry.png" alt="in basket" width="15" height="15" border="0"/>
701 <span id="{/page/pageResponse/collection/@name}:{$selectedNode}:section" class="documentberry">the current section</span>
702 </xsl:if>-->
703 </div>
704 </xsl:if>
705 </xsl:template>
706
707 <!-- document page -->
708 <xsl:template name="documentTitle">
709 <xsl:value-of select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']"/>
710 </xsl:template>
711 <xsl:template name="coverImage">
712 <img>
713 <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>
714 </img>
715 </xsl:template>
716
717 <xsl:template name="previousNextButtons">
718 <!-- prev -->
719 <a>
720 <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>
721 <img class="lessarrow" src="interfaces/{$interface_name}/images/previous.png"/>
722 </a>
723 <!-- next -->
724 <a>
725 <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>
726 <img class="morearrow" src="interfaces/{$interface_name}/images/next.png"/>
727 </a>
728 </xsl:template>
729
730
731 <!-- This next template expands gslib:langfrag (used by document.xsl and documentbasket.xsl).
732 When debugging with o=skinandlibdoc, it's seen that <gslib:langfrag name='dse' /> gets expanded to:
733 <xsl:call-template name="langfrag">
734 <xsl:with-param name="name">dse</xsl:with-param>
735 </xsl:call-template>
736 Before the param can be used in this template, need to retrieve it by name with <xsl:param/>
737 as explained in http://www.maconstateit.net/tutorials/XML/XML05/xml05-05.aspx
738 -->
739 <xsl:template name="langfrag">
740 <xsl:param name="name"/>
741 <script type="text/javascript">
742 <xsl:value-of disable-output-escaping="yes" select="util:getInterfaceStringsAsJavascript($interface_name, /page/@lang, $name)"/>
743 </script>
744 </xsl:template>
745
746
747 <!-- builds up links to available document types equivalent to the default source
748 document with as anchor the equivalent documents' doctype icons. -->
749 <xsl:template name="equivDocLinks">
750 <xsl:param name="count"/>
751
752 <xsl:variable name="docicon" select="metadataList/metadata[contains(@name, 'equivDocIcon')]"/>
753 <xsl:variable name="docEndlink" select="metadataList/metadata[contains(@name, '/equivDocLink')]"/>
754
755 <!--<xsl:variable name="docStartlink" select="metadataList/metadata[contains(@name, 'all_*,*_equivDocLink')]"/>-->
756 <!-- In the following variable statement, we're trying to set the docStartlink to any metadata whose value
757 ends on equivDocLink but NOT /equivDocLink. Unfortunately, the xslt function fn:ends-with only exists from
758 xslt 2.0 onwards. So need to use substring() and string-lenth() functions now to check whether the 13th char
759 from the end is a slash or not, in order to distinguish between the start of a doclink and end of one.
760 If this 13th char from the end is not a slash, then we found (the string we want to store in) docStartlink. -->
761 <xsl:variable name="docStartlink">
762 <xsl:for-each select="metadataList/metadata">
763 <xsl:if test="contains(@name, 'equivDocLink')">
764 <xsl:variable name="tmpvar" select="substring(@name, string-length(@name)-12, 1)"/>
765 <xsl:if test="not($tmpvar='/')">
766 <xsl:value-of select="self::node()[@name]"/>
767 </xsl:if>
768 </xsl:if>
769 </xsl:for-each>
770 </xsl:variable>
771
772 <xsl:variable name="equivDocIcon" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docicon, $count)" />
773 <xsl:variable name="equivStartlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docStartlink, $count)" />
774 <xsl:variable name="equivEndlink" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($docEndlink, $count)" />
775
776 <xsl:if test="$equivDocIcon != ''">
777 <xsl:value-of disable-output-escaping="yes" select="$equivStartlink"/>
778 <xsl:value-of disable-output-escaping="yes" select="$equivDocIcon"/>
779 <xsl:value-of disable-output-escaping="yes" select="$equivEndlink"/>
780
781 <!-- recursively call this template to get multiple entries -->
782 <xsl:call-template name="equivDocLinks">
783 <xsl:with-param name="count"><xsl:value-of select="$count + 1"/></xsl:with-param>
784 </xsl:call-template>
785 </xsl:if>
786
787 </xsl:template>
788
789</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.