root/other-projects/tipple-android/i-greenstone-server-files/greenstone/webapps/greenstone3/interfaces/gs2/transform/document.xsl @ 26899

Revision 26899, 27.7 KB (checked in by davidb, 7 years ago)

Tipple reborn after Chris's Summer of Code 2013

  • Property svn:mime-type set to application/xml
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4  xmlns:java="http://xml.apache.org/xslt/java"
5  xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6  xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
7  extension-element-prefixes="java util"
8  exclude-result-prefixes="java util gsf">
9
10  <!-- style includes global params interface_name, library_name -->
11  <xsl:include href="style.xsl"/>
12  <xsl:include href="service-params.xsl"/>
13  <xsl:output method="html"/>
14 
15  <!-- the main page layout template is here -->
16  <!-- override the one in style so we can display the doc over the whole page and get rid of the green bar down the side -->
17  <xsl:template match="page" priority='2'>
18    <html>
19      <head>
20    <title>
21      <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
22      <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
23    </title>
24    <xsl:call-template name="globalStyle"/>
25    <xsl:call-template name="pageStyle"/>
26      </head>
27      <body style="background-image: none;">
28        <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
29        <div id="page-wrapper">
30      <xsl:apply-templates select="pageResponse"/>
31      <xsl:call-template name="greenstoneFooter"/>
32    </div> 
33      </body>
34    </html>
35  </xsl:template>
36 
37  <xsl:template name="pageTitle">
38    <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
39    <xsl:for-each select='/page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode'><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each>
40  </xsl:template>
41
42  <!-- this is hard coded for GATE, should somehow do it dynamically-->
43  <xsl:template name="pageStyle">
44    <style type="text/css">
45      <xsl:text disable-output-escaping="yes">
46    span.Location {  display:inline; color : red }
47    span.Person {  display:inline; color : green }
48    span.Organization {  display:inline; color : yellow }
49    span.Date {  display:inline; color : blue }
50    span.query_term {display: inline; background-color : yellow }
51      </xsl:text>
52    </style>
53  </xsl:template>
54 
55  <xsl:template match="pageResponse">
56    <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
57    <xsl:call-template name="standardPageBanner">
58      <xsl:with-param name="collName" select="$collName"/>
59    </xsl:call-template>
60    <xsl:call-template name="navigationBar">
61      <xsl:with-param name="collName" select="$collName"/>
62    </xsl:call-template>
63    <div class="document">     
64      <!-- display the document -->
65      <xsl:apply-templates select="document">
66    <xsl:with-param name="collName" select="$collName"/>
67      </xsl:apply-templates>
68    </div>
69  </xsl:template>
70 
71  <xsl:template match="document">
72    <xsl:param name="collName"/>
73
74    <xsl:variable name="external"><xsl:value-of select="/page/pageResponse/document/@external"/></xsl:variable>
75    <xsl:choose><xsl:when test="$external != ''">
76    <xsl:call-template name="externalPage">
77      <xsl:with-param name="external" select="$external"/>
78    </xsl:call-template>
79      </xsl:when>
80      <xsl:otherwise>
81   
82    <xsl:call-template name="documentHeading">
83      <xsl:with-param name="collName" select="$collName"/>
84    </xsl:call-template>
85   
86    <xsl:call-template name="documentArrows">
87      <xsl:with-param name="collName" select="$collName"/>
88    </xsl:call-template>         
89    <xsl:call-template name="documentContent">
90      <xsl:with-param name="collName" select="$collName"/>
91    </xsl:call-template>
92    <xsl:call-template name="documentArrows">
93      <xsl:with-param name="collName" select="$collName"/>
94    </xsl:call-template>
95    <br/>
96      </xsl:otherwise></xsl:choose>
97  </xsl:template>
98 
99  <xsl:template name="documentArrows">
100    <xsl:param name="collName"/>   
101    <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>   
102    <xsl:variable name="dir"><xsl:call-template name="direction"/></xsl:variable>   
103    <xsl:variable name="firstDir"><xsl:choose><xsl:when test="$dir='rtl'">forward</xsl:when><xsl:otherwise>back</xsl:otherwise></xsl:choose></xsl:variable>
104    <xsl:variable name="secondDir"><xsl:choose><xsl:when test="$dir='rtl'">back</xsl:when><xsl:otherwise>forward</xsl:otherwise></xsl:choose></xsl:variable>   
105   
106    <div class="documentarrows">
107      <xsl:if test="not(string($ed)='1')">
108    <xsl:call-template name="documentArrow">
109      <xsl:with-param name="collName" select="$collName"/>
110      <xsl:with-param name="direction" select="$firstDir"/>
111      <xsl:with-param name="pageDir" select="$dir"/>
112    </xsl:call-template>
113    <xsl:call-template name="documentArrow">
114      <xsl:with-param name="collName" select="$collName"/>
115      <xsl:with-param name="direction" select="$secondDir"/>
116      <xsl:with-param name="pageDir" select="$dir"/>
117    </xsl:call-template>
118      </xsl:if>
119    </div>   
120  </xsl:template>
121 
122  <xsl:template name="documentArrow">
123    <xsl:param name="collName"/>
124    <xsl:param name="direction"/>
125    <xsl:param name="pageDir"/>
126   
127    <xsl:variable name="disp">
128      <xsl:choose>
129    <xsl:when test="$direction ='back' and nodeStructureInfo/info[@name='siblingPosition']/@value = -1">n</xsl:when>
130    <xsl:when test="$direction ='forward' and nodeStructureInfo/info[@name='siblingPosition']/@value = nodeStructureInfo/info[@name='numSiblings']/@value">n</xsl:when>         
131    <xsl:otherwise>y</xsl:otherwise>
132      </xsl:choose>
133    </xsl:variable>
134
135    <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
136    <xsl:if test='$request-params/param[@name="dt"]/@value != "simple" and $disp = "y"'> 
137      <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;c=<xsl:value-of select="$collName"/>&amp;d=<xsl:value-of select="@selectedNode"/><xsl:choose><xsl:when test="$direction='back'">.pp</xsl:when><xsl:otherwise>.np</xsl:otherwise></xsl:choose>&amp;sib=1&amp;p.s=<xsl:value-of select='$request-params/param[@name="p.s"]/@value'/>&amp;p.sa=<xsl:value-of select='$request-params/param[@name="p.sa"]/@value'/>&amp;p.a=<xsl:value-of select='$request-params/param[@name="p.a"]/@value'/></xsl:attribute><xsl:choose>
138      <xsl:when test="$direction='back'"><img class="lessarrow{$pageDir}" src="interfaces/basic/images/less.gif" /></xsl:when><xsl:otherwise><img class="morearrow{$pageDir}" src="interfaces/basic/images/more.gif"  /></xsl:otherwise></xsl:choose></a>
139    </xsl:if>
140  </xsl:template>
141 
142
143  <xsl:template name="documentHeading">
144    <xsl:param name="collName"/>
145    <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
146    <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
147    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
148    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
149    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
150    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
151    <div id="documentheading">
152      <a href="{$library_name}?a={$p.a}&amp;sa={$p.sa}&amp;s={$p.s}&amp;c={$p.c}&amp;rt=rd"><xsl:call-template name="openbookimg"><xsl:with-param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'close_book')"/></xsl:with-param>
153    </xsl:call-template></a>
154      <xsl:choose><xsl:when test="@docType='simple'"><xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose>
155    </div>
156
157    <div id="docheadwrapper">
158      <div id="documentinfo">
159        <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
160          <div id="headingimage">
161        <xsl:call-template name="coverImage"/>
162          </div>
163        </xsl:if>
164   
165        <ul id="docbuttons" >
166      <xsl:call-template name="documentButtons">
167        <xsl:with-param name="collName" select="$collName"/>
168      </xsl:call-template>
169    </ul>
170      </div>
171     
172      <!--<div><xsl:call-template name="enrichServices">
173      <xsl:with-param name="collName" select="$collName"/>
174    </xsl:call-template></div>-->
175     
176      <xsl:if test="string($doTOC) != 'false'">
177    <div id="toc">
178      <xsl:call-template name="TOC">
179        <xsl:with-param name="collName" select="$collName"/>
180      </xsl:call-template>
181    </div>
182      </xsl:if>
183    </div>
184  </xsl:template>
185
186  <xsl:template name="coverImage">
187    <img alt="" onError="src='interfaces/gs2/images/blank.gif'"><xsl:attribute name='src'><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
188  </xsl:template>
189
190  <xsl:template name="documentButtons">
191    <xsl:param name="collName"/>
192    <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
193    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
194    <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
195    <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
196   
197    <!-- added params, otherwise the bookicon link becomes broken after click one of these buttons -->
198    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
199    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
200    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
201    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
202   
203    <!-- expand document -->
204    <xsl:if test="@docType = 'hierarchy'">
205      <div class="button">
206        <span class="button">
207      <xsl:choose><xsl:when test="string($ed)='1'">
208          <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ed=0&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_doc_tip')"/></xsl:attribute>
209        <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_doc_b')"/>
210          </a>
211        </xsl:when>
212        <xsl:otherwise>
213          <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ed=1&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_doc_tip')"/></xsl:attribute>
214        <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_doc_b')"/>
215          </a>
216        </xsl:otherwise>
217      </xsl:choose>
218    </span>
219      </div>
220    </xsl:if>
221   
222    <!-- expand contents -->
223    <xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
224      <div class="button">
225        <span class="button">
226      <xsl:choose><xsl:when test="string($ec)='1'">
227          <a  href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=0&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_tip')"/></xsl:attribute>
228        <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_b')"/>
229          </a>
230        </xsl:when>
231        <xsl:otherwise>
232          <a  href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=1&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_tip')"/></xsl:attribute>
233        <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_b')"/>
234          </a>
235        </xsl:otherwise>
236      </xsl:choose>
237    </span>
238      </div>
239    </xsl:if>
240    <!-- detach page -->
241    <xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
242    <div class="button">
243      <span class="button">
244    <a  target="_blank"><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;d=<xsl:value-of select="$docID"/>&amp;c=<xsl:value-of select="$collName"/>&amp;sib=<xsl:value-of select="$sib"/>&amp;dt=<xsl:value-of select="$paramList/param[@name='dt']/@value"/>&amp;ec=<xsl:value-of select="$paramList/param[@name='ec']/@value"/>&amp;et=<xsl:value-of select="$paramList/param[@name='et']/@value"/>&amp;p.a=<xsl:value-of select="$paramList/param[@name='p.a']/@value"/>&amp;p.s=<xsl:value-of select="$paramList/param[@name='p.s']/@value"/>&amp;p.sa=<xsl:value-of select="$paramList/param[@name='p.sa']/@value"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.detach_page_tip')"/></xsl:attribute>
245      <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.detach_page_b')"/>
246    </a>
247      </span>
248    </div>
249  </xsl:template>
250
251  <xsl:template name="TOC">
252    <xsl:param name="collName"/>
253    <xsl:choose>
254      <xsl:when test="@docType='hierarchy'">
255    <xsl:call-template name="hierarchicalContents">
256      <xsl:with-param name="collName" select="$collName"/>
257    </xsl:call-template>
258      </xsl:when>
259      <xsl:when test="@docType='paged'">
260    <xsl:call-template name="pagedContents">
261      <xsl:with-param name="collName" select="$collName"/>
262    </xsl:call-template>
263      </xsl:when>
264    </xsl:choose>
265  </xsl:template>
266 
267  <xsl:template name="hierarchicalContents">
268    <xsl:param name="collName"/>
269    <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
270    <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
271    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
272    <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
273   
274    <!-- added parameters -->
275    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
276    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
277    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
278    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
279   
280    <xsl:if test="documentNode[@nodeID]">
281      <ul id="tocnodes">
282    <li>
283      <xsl:choose><xsl:when test="string($oc)='0'">
284          <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={$d}&amp;sib={$sib}&amp;oc=1&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:call-template name="closedfolderimg"><xsl:with-param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.open_toc')"/></xsl:with-param></xsl:call-template></a>
285        </xsl:when>
286        <xsl:otherwise><a href="{$library_name}?a=d&amp;c={$collName}&amp;d={$d}&amp;sib={$sib}&amp;oc=0&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><xsl:call-template name="openfolderimg"><xsl:with-param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.close_toc')"/></xsl:with-param></xsl:call-template></a></xsl:otherwise></xsl:choose>
287      <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.table_of_contents')"/>
288      <xsl:if test="string($oc)!='0'">
289        <ul class="tocnode">
290          <xsl:for-each select="documentNode/documentNode[@nodeID]">
291        <xsl:apply-templates select='.'>
292          <xsl:with-param name="collName" select="$collName"/><xsl:with-param name="ec" select="$ec"/>
293         
294          <!-- added parameters -->
295          <xsl:with-param name="p.a" select="$p.a"/>
296          <xsl:with-param name="p.s" select="$p.s"/>
297          <xsl:with-param name="p.sa" select="$p.sa"/>
298          <xsl:with-param name="p.c" select="$p.c"/>
299         
300        </xsl:apply-templates>
301          </xsl:for-each>
302        </ul>
303      </xsl:if>
304    </li>
305      </ul>
306    </xsl:if>
307  </xsl:template>
308 
309  <!-- each icon-title pair is a row in a table. children go in a table in another row -->
310  <xsl:template match="documentNode">
311    <xsl:param name="collName"/>
312    <xsl:param name="ec"/>
313   
314    <!-- added these parameters to be carried when changing in toc -->
315    <xsl:param name="p.a"/>
316    <xsl:param name="p.s"/>
317    <xsl:param name="p.sa"/>
318    <xsl:param name="p.c"/>
319    <!-- Display the appropriate image, depending on the node type -->
320   
321    <li>
322      <!--
323      <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if><xsl:if test="string($ec) = '1'">&amp;ec=1</xsl:if></xsl:attribute>
324      -->   
325     
326      <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="documentNode">.pr</xsl:if>&amp;sib=1<xsl:if test="string($ec) = '1'">&amp;ec=1</xsl:if>&amp;p.a=<xsl:value-of select="$p.a"/>&amp;p.sa=<xsl:value-of select="$p.sa"/>&amp;p.s=<xsl:value-of select="$p.s"/>&amp;p.c=<xsl:value-of select="$p.c"/></xsl:attribute>
327   
328    <xsl:apply-templates select="." mode="displayNodeIcon"/>
329      </a>
330     
331      <!-- Display associated title, bolded if the node has content -->
332      <xsl:choose>
333    <xsl:when test="nodeContent">
334      <span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
335    </xsl:when>
336    <xsl:otherwise>
337      <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
338    </xsl:otherwise>
339      </xsl:choose>
340
341      <!-- Apply recursively to the children of this node -->
342      <xsl:if test="documentNode[@nodeID]">
343   
344    <ul class="tocnode"> <xsl:apply-templates select="documentNode[@nodeID]">
345        <xsl:with-param name="collName" select="$collName"/>
346        <xsl:with-param name="ec" select="$ec"/>
347       
348        <!-- added parameters -->
349        <xsl:with-param name="p.a" select="$p.a"/><xsl:with-param name="p.s" select="$p.s"/><xsl:with-param name="p.sa" select="$p.sa"/><xsl:with-param name="p.c" select="$p.c"/>
350        <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
351      </xsl:apply-templates>
352    </ul>
353      </xsl:if>
354    </li>
355  </xsl:template>
356 
357  <!-- default content is to print the title and content of any documentNodes that have nodeContent -->
358  <xsl:template name="documentContent">
359    <div class="documenttext">
360      <xsl:choose>
361        <xsl:when test="@docType='simple'">
362      <xsl:apply-templates select="nodeContent"/>
363    </xsl:when>
364        <xsl:otherwise>
365      <xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>
366        </xsl:otherwise>
367      </xsl:choose>
368    </div>
369  </xsl:template>
370 
371  <xsl:template match="documentNode" mode="content">
372    <xsl:if test="nodeContent and string(nodeContent)">
373      <xsl:if test="metadataList/metadata[@name='Title']">
374    <h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
375      </xsl:if>
376      <xsl:apply-templates select="nodeContent"/>
377    </xsl:if>
378   
379  </xsl:template>
380
381  <!-- the actual text/content -->
382  <xsl:template match="nodeContent">
383    <p/>
384    <xsl:for-each select="node()">
385      <xsl:choose>
386    <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
387    <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
388      </xsl:choose>
389    </xsl:for-each>
390  </xsl:template>
391 
392  <!-- match any file nodes -->
393  <xsl:template match="file">
394    <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
395    <xsl:choose>
396      <xsl:when test="util:isImage(@mimeType)">
397    <img src="{$httpPath}/{@href}"/>
398      </xsl:when>
399      <xsl:otherwise>
400    <a href="{$httpPath}/{@href}"><xsl:value-of select="@href"/></a>
401      </xsl:otherwise>
402    </xsl:choose>
403  </xsl:template>
404 
405  <!-- match any link nodes -->
406  <xsl:template match="link">
407    <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
408    <xsl:variable name="actionargs">
409      <xsl:choose>
410    <xsl:when test="@type='document'">a=d</xsl:when>
411    <xsl:when test="@type='query'">a=q&amp;s=<xsl:value-of select="@service"/>&amp;rt=r</xsl:when>
412    <xsl:otherwise>
413      p
414    </xsl:otherwise>
415      </xsl:choose>
416    </xsl:variable>
417    <xsl:variable name="serviceargs">
418      <xsl:for-each select="param">&amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
419    </xsl:variable>
420    <a href="{$library_name}?{$actionargs}&amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
421  </xsl:template>
422
423  <!-- match any annotations and make them span elements -->
424  <xsl:template match="annotation">
425    <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
426  </xsl:template>
427 
428  <!-- paged naviagtion : INCOMPLETE!!-->
429  <xsl:template name="pagedContents">
430    <xsl:param name="collName"/>
431    <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
432    <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
433    <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
434    <!-- parameters for the bookicon to work properly -->
435    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
436    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
437    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
438    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
439
440    <xsl:choose>
441      <xsl:when test="$pos=-1"><!-- a doc -->
442    <tr valign="top">
443      <td align="left">
444      </td>
445      <td align="center"><center>
446          <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.pages', $children)"/></b>
447        </center></td>
448      <td align="right">
449        <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.fc&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><img src="interfaces/basic/images/more.gif" border="0" align="absbottom" /></a>
450      </td>
451    </tr>
452      </xsl:when>
453     
454      <xsl:otherwise> <!-- an internal node -->   
455    <tr valign="top">
456      <td align="left">
457        <xsl:if test=" not ( $pos = 1 )">
458          <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ps&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><img src="interfaces/basic/images/less.gif" border="0" align="absbottom" /></a>
459        </xsl:if>
460      </td>
461      <td align="center"><center>
462          <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.pageof', concat($pos, ';', $length))"/></b>
463        </center></td>
464      <td align="right">
465        <xsl:if test=" not($pos = $length)">
466          <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ns&amp;p.s={$p.s}&amp;p.sa={$p.sa}&amp;p.a={$p.a}&amp;p.c={$p.c}"><img src="interfaces/basic/images/more.gif" border="0" align="absbottom" /></a>
467        </xsl:if>
468      </td>
469    </tr>
470      </xsl:otherwise>
471    </xsl:choose>
472    <tr valign="middle">
473      <td align='center' valign='top' colspan='3'>
474    <form name="GotoForm" method="get" action="{$library_name}">
475      <input type='hidden' name='a' value='d'/>
476      <input type='hidden' name='c' value='{$collName}'/>
477      <!--<input type='hidden' name='d' value='{@selectedNode}'/>-->
478      <input type='hidden' name='d'>
479        <xsl:attribute name='value'>
480          <xsl:if test="contains(@selectedNode, '.')"><xsl:value-of select="@selectedNode"/></xsl:if>
481          <xsl:if test="not(contains(@selectedNode, '.'))"><xsl:value-of select="@selectedNode"/>.0</xsl:if>
482        </xsl:attribute>
483      </input>             
484     
485      <input type='hidden' name='p.s' value='{$p.s}'/>
486      <input type='hidden' name='p.sa' value='{$p.sa}'/>
487      <input type='hidden' name='p.a' value='{$p.a}'/>
488      <input type='hidden' name='p.c' value='{$p.c}'/>   
489     
490      <input type="text" name="gp" size="3" maxlength="4"/>
491      <input type="submit"><xsl:attribute name='value'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.gotopage')"/></xsl:attribute></input>
492    </form>
493      </td>
494    </tr>
495  </xsl:template>
496 
497  <xsl:template name="enrichServices">
498    <xsl:param name="collName"/>
499    <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
500    <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
501    <xsl:for-each select="../serviceList/service">
502      <table border='1' cellspacing='0'>
503    <tr><td>
504        <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
505        <form name="EnrichForm" method="get" action="{$library_name}">
506          <xsl:apply-templates select="paramList"/>
507          <input type='hidden' name='a' value='d'/>
508          <input type='hidden' name='d' value='{$docID}'/>
509          <input type='hidden' name='c' value='{$collName}'/>
510          <xsl:if test='$request-params/param[@name="sib"]'>
511        <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if>
512          <input type='hidden' name='s' value='{@name}'/>
513          <input type='hidden' name='p.a'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.a"]'/></xsl:attribute></input>
514          <input type='hidden' name='p.sa'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.sa"]'/></xsl:attribute></input>
515          <input type='hidden' name='p.s'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.s"]'/></xsl:attribute></input>
516          <input type='hidden' name='end' value='1'/>
517          <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
518        </form>
519      </td></tr>
520      </table>
521    </xsl:for-each>
522  </xsl:template>
523
524  <xsl:template match="paramList" mode="hidden">
525    <xsl:for-each select="param">
526      <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
527      </xsl:text>
528    </xsl:for-each>
529  </xsl:template>
530
531  <xsl:template name="externalPage">
532    <xsl:param name="external"/>
533    <xsl:variable name="go_forward_link"><a><xsl:attribute name="href"><xsl:value-of select="$external"/></xsl:attribute><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/></a></xsl:variable>
534    <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
535    <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/>
536    </p>
537  </xsl:template>
538
539
540</xsl:stylesheet>
541
542
543
544
Note: See TracBrowser for help on using the browser.