root/main/trunk/greenstone3/web/interfaces/default/transform/gslib.xsl @ 31432

Revision 31432, 40.4 KB (checked in by kjdon, 3 years ago)

preProcess.xml lists some more namespaces that were not defined here. was getting xmlns attributes in hte output html tag. this seems to be the place that is providing this list to the output, so all namespaces should be declared here so we can remove them from the output. hope this doesn't break anything, eg if we are going to an intermediate XSL form where the namespaces are needed!

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