source: greenstone3/trunk/web/interfaces/gs2/transform/document.xsl@ 17019

Last change on this file since 17019 was 17019, checked in by max, 16 years ago

Move the HTML skeleton from style.xsl to the current XSL file.

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