source: greenstone3/trunk/web/interfaces/default/transform/document.xsl@ 17017

Last change on this file since 17017 was 17017, 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: 30.2 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:include href="berrytools.xsl"/>
14
15 <xsl:output method="html"/>
16
17 <!-- the main page layout template is here -->
18 <xsl:template match="page">
19 <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
20 <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
21
22 <xsl:choose>
23 <xsl:when test="$bookswitch = 'flashxml' and $a = 'd'">
24 <html>
25 <xsl:call-template name="response" />
26 </html>
27 </xsl:when>
28
29 <xsl:otherwise>
30 <html>
31 <head>
32 <title>
33 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
34 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
35 </title>
36 <xsl:call-template name="globalStyle"/>
37 <xsl:call-template name="pageStyle"/>
38 </head>
39 <body>
40 <div id="globalwrapper">
41 <xsl:call-template name="response" />
42 <xsl:call-template name="greenstoneFooter"/>
43 </div>
44 </body>
45 </html>
46 </xsl:otherwise>
47 </xsl:choose>
48 </xsl:template>
49
50
51 <xsl:variable name="berrybasketswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:variable>
52 <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
53
54 <xsl:template name="pageTitle">
55 <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
56 <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>
57 </xsl:template>
58
59 <!-- this is hard coded for GATE, should somehow do it dynamically-->
60 <xsl:template name="pageStyle">
61 <style type="text/css">
62 <xsl:text disable-output-escaping="yes">
63 span.Location { display:inline; color : red }
64 span.Person { display:inline; color : green }
65 span.Organization { display:inline; color : yellow }
66 span.Date { display:inline; color : blue }
67 span.query_term {display: inline; background-color : yellow }
68 </xsl:text>
69 </style>
70 <!--TODO: add berry basket switch-->
71 <!--<xsl:if test="$berryBaskets = 'true'">-->
72 <xsl:if test="$berrybasketswitch = 'on'">
73 <xsl:call-template name="berryStyleSheet"/>
74 <xsl:call-template name="js-library"/>
75 </xsl:if>
76 </xsl:template>
77
78 <xsl:template match="pageResponse">
79 <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
80 <xsl:choose>
81 <xsl:when test="$bookswitch = 'on' or $bookswitch = 'off'">
82 <xsl:call-template name="standardPageBanner">
83 <xsl:with-param name="collName" select="$collName"/>
84 </xsl:call-template>
85 <xsl:call-template name="navigationBar">
86 <xsl:with-param name="collName" select="$collName"/>
87 </xsl:call-template>
88
89 <!--<xsl:if test="$berryBaskets = 'true'">-->
90 <xsl:if test="$berrybasketswitch = 'on'">
91 <xsl:call-template name="documentBerryBasket">
92 <xsl:with-param name="collName" select="$collName"/>
93 <xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
94 <xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
95 <xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
96 </xsl:call-template>
97 </xsl:if>
98 </xsl:when>
99 </xsl:choose>
100
101 <!-- display the document -->
102 <xsl:if test="$bookswitch != 'flashxml'">
103 <xsl:text disable-output-escaping="yes">&lt;div id="content"&gt;</xsl:text>
104 </xsl:if>
105 <xsl:apply-templates select="document">
106 <xsl:with-param name="collName" select="$collName"/>
107 </xsl:apply-templates>
108 <xsl:if test="$bookswitch != 'flashxml'">
109 <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
110 </xsl:if>
111 </xsl:template>
112
113 <xsl:template match="document">
114 <xsl:param name="collName"/>
115 <xsl:variable name="external"><xsl:value-of select="/page/pageResponse/document/@external"/></xsl:variable>
116 <xsl:choose>
117 <xsl:when test="$external != ''">
118 <xsl:call-template name="externalPage">
119 <xsl:with-param name="external" select="$external"/>
120 </xsl:call-template>
121 </xsl:when>
122 <xsl:otherwise>
123
124 <xsl:if test="$bookswitch = 'flashxml'">
125 <xsl:call-template name="xmldocumentContentPeeling">
126 <xsl:with-param name="collName" select="$collName"/>
127 </xsl:call-template>
128 </xsl:if>
129
130 <xsl:if test="$bookswitch = 'off'">
131 <xsl:call-template name="documentHeading">
132 <xsl:with-param name="collName" select="$collName"/>
133 </xsl:call-template>
134
135 <xsl:call-template name="documentArrows">
136 <xsl:with-param name="collName" select="$collName"/>
137 </xsl:call-template>
138 <xsl:call-template name="documentContent">
139 <xsl:with-param name="collName" select="$collName"/>
140 </xsl:call-template>
141 <xsl:call-template name="documentArrows">
142 <xsl:with-param name="collName" select="$collName"/>
143 </xsl:call-template>
144 </xsl:if>
145 <xsl:if test="$bookswitch = 'on'">
146 <xsl:call-template name="documentHeading">
147 <xsl:with-param name="collName" select="$collName"/>
148 </xsl:call-template>
149 <div id="bookdiv"></div>
150 <script type="text/javascript">
151 <xsl:text disable-output-escaping="yes">
152 var doc_url = document.URL;
153 doc_url = doc_url.replace(/(&amp;|\?)book=[a-z]+/gi,'');
154 doc_url += '&amp;book=flashxml';
155
156 // var src_image = "http://kia.cs.waikato.ac.nz:8080/greenstone3/sites/localsite/collect/gs2mgdemo/index/assoc/HASH49aa.dir/cover.jpg"
157 //var doc_url = "/greenstone3/library?a=d&amp;c=gs2mgdemo&amp;d=HASH49aab56062938fbe2ff7f1&amp;dt=hierarchy&amp;p.a=b&amp;p.s=ClassifierBrowse&amp;ed=1";
158
159 var flash_plug_html = ""
160 flash_plug_html += '&lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
161 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
162 flash_plug_html += ' height="100%" id="Book" swLiveConnect="true" \n';
163 flash_plug_html += ' width="100%"&gt;\n';
164 flash_plug_html += ' &lt;PARAM name="allowScriptAccess" value="always" /&gt;\n';
165 flash_plug_html += ' &lt;PARAM name="movie" value="Book.swf';
166 flash_plug_html += '?src_image=' + escape(img_cover);
167 flash_plug_html += '&amp;doc_url=' + escape(doc_url)
168 flash_plug_html += '" /&gt;\n';
169 flash_plug_html += ' &lt;PARAM name="quality" value="high" /&gt;\n';
170 flash_plug_html += ' &lt;PARAM name="bgcolor" value="#FFFFFF" /&gt;\n';
171 flash_plug_html += ' &lt;EMBED align="middle" \n';
172 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \n';
173 flash_plug_html += ' bgcolor="#FFFFFF" height="100%" name="Book" \n';
174 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
175 flash_plug_html += ' quality="high" \n';
176 flash_plug_html += ' src="Book.swf';
177 flash_plug_html += '?src_image=' + escape(img_cover);
178 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
179 flash_plug_html += '"\n';
180 flash_plug_html += ' type="application/x-shockwave-flash" width="100%" /&gt;\n';
181 flash_plug_html += '&lt;/OBJECT&gt;\n';
182 var flash_div = document.getElementById("bookdiv");
183 flash_div.innerHTML = flash_plug_html;
184 </xsl:text>
185 </script>
186 </xsl:if>
187 </xsl:otherwise>
188 </xsl:choose>
189 </xsl:template>
190
191 <xsl:template name="documentHeading">
192 <xsl:param name="collName"/>
193 <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
194 <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
195 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
196 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
197 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
198 <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>
199 <div id="documentheading">
200 <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>
201 </xsl:call-template></a>
202 <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>
203 </div>
204
205 <div id="docheadwrapper">
206 <div id="documentinfo">
207
208 <xsl:choose>
209 <xsl:when test="$bookswitch = 'on'">
210 <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
211 <div id="headingimage">
212 <xsl:call-template name="coverImage"/>
213 </div>
214 </xsl:if>
215 </xsl:when>
216 <xsl:otherwise>
217 <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
218 <div id="headingimage">
219 <xsl:call-template name="coverImage"/>
220 </div>
221 </xsl:if>
222
223 <ul id="docbuttons" >
224 <xsl:call-template name="documentButtons">
225 <xsl:with-param name="collName" select="$collName"/>
226 </xsl:call-template>
227 </ul>
228 </xsl:otherwise>
229 </xsl:choose>
230 </div>
231 <!--<div><xsl:call-template name="enrichServices">
232 <xsl:with-param name="collName" select="$collName"/>
233 </xsl:call-template></div>-->
234 <xsl:if test="$bookswitch = 'off'">
235 <xsl:if test="string($doTOC) != 'false'">
236 <div id="toc">
237 <xsl:call-template name="TOC">
238 <xsl:with-param name="collName" select="$collName"/>
239 </xsl:call-template>
240 </div>
241 </xsl:if>
242 </xsl:if>
243 </div>
244 </xsl:template>
245
246 <xsl:template name="coverImage">
247 <xsl:choose>
248 <xsl:when test="$bookswitch = 'on'">
249 <script type="text/javascript">
250 <xsl:text disable-output-escaping="yes">var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';</xsl:text>
251 </script>
252 </xsl:when>
253 <xsl:otherwise>
254 <img><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>
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:template>
258
259 <xsl:template name="documentButtons">
260 <xsl:param name="collName"/>
261 <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
262 <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
263 <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
264 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
265
266
267 <!-- expand document -->
268 <!-- this doesn't work with MG so comment it out for now -->
269
270 <xsl:if test="@docType = 'hierarchy' or @docType = 'paged'">
271 <li>
272 <xsl:choose><xsl:when test="string($ed)='1'">
273 <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ed=0"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_doc_tip')"/></xsl:attribute>
274 <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_doc_b')"/>
275 </a>
276 </xsl:when>
277 <xsl:otherwise>
278 <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ed=1"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_doc_tip')"/></xsl:attribute>
279 <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_doc_b')"/>
280 </a>
281 </xsl:otherwise>
282 </xsl:choose>
283 </li>
284 </xsl:if>
285
286 <!-- expand contents -->
287 <xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
288 <li>
289 <xsl:choose><xsl:when test="string($ec)='1'">
290 <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=0"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_tip')"/></xsl:attribute>
291 <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.contract_contents_b')"/></a>
292 </xsl:when>
293 <xsl:otherwise>
294 <a href="{$library_name}?a=d&amp;d={$docID}&amp;c={$collName}&amp;sib={$sib}&amp;ec=1"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_tip')"/></xsl:attribute>
295 <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.expand_contents_b')"/>
296 </a>
297 </xsl:otherwise>
298 </xsl:choose>
299 </li>
300 </xsl:if>
301
302 <!-- detach page -->
303 <xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
304 <li>
305 <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>
306 <xsl:value-of disable-output-escaping='yes' select="util:getInterfaceText($interface_name, /page/@lang, 'doc.detach_page_b')"/>
307 </a></li>
308 </xsl:template>
309
310 <xsl:template name="TOC">
311 <xsl:param name="collName"/>
312 <xsl:choose>
313 <xsl:when test="@docType='hierarchy'">
314 <xsl:call-template name="hierarchicalContents">
315 <xsl:with-param name="collName" select="$collName"/>
316 </xsl:call-template>
317 </xsl:when>
318 <xsl:when test="@docType='paged'">
319 <xsl:call-template name="pagedContents">
320 <xsl:with-param name="collName" select="$collName"/>
321 </xsl:call-template>
322 </xsl:when>
323 </xsl:choose>
324 </xsl:template>
325
326 <xsl:template name="hierarchicalContents">
327 <xsl:param name="collName"/>
328 <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
329 <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
330 <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
331 <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
332 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
333 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
334 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
335 <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>
336 <xsl:if test="documentNode[@nodeID]">
337 <ul id="tocnodes">
338 <li>
339 <xsl:choose><xsl:when test="string($oc)='0'">
340 <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>
341 </xsl:when>
342 <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>Table of Contents
343 <xsl:if test="string($oc)!='0'">
344 <ul class="tocnode">
345 <xsl:for-each select="documentNode/documentNode[@nodeID]">
346 <xsl:apply-templates select='.'><xsl:with-param name="collName" select="$collName"/><xsl:with-param name="ec" select="$ec"/><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"/></xsl:apply-templates>
347 </xsl:for-each>
348 </ul>
349 </xsl:if>
350 </li>
351 </ul>
352 </xsl:if>
353 </xsl:template>
354
355 <!-- each icon-title pair is a row in a table. children go in a table in another row -->
356 <xsl:template match="documentNode">
357 <xsl:param name="collName"/>
358 <xsl:param name="ec"/>
359 <xsl:param name="p.a"/>
360 <xsl:param name="p.s"/>
361 <xsl:param name="p.sa"/>
362 <xsl:param name="p.c"/>
363 <!-- Display the appropriate image, depending on the node type -->
364 <li>
365 <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>
366 <xsl:apply-templates select="." mode="displayNodeIcon"/>
367 </a>
368
369 <!-- Display associated title, bolded if the node has content -->
370 <xsl:choose>
371 <xsl:when test="nodeContent">
372 <span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
373 </xsl:when>
374 <xsl:otherwise>
375 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/>
376 </xsl:otherwise>
377 </xsl:choose>
378 <!-- Apply recursively to the children of this node -->
379 <xsl:if test="documentNode[@nodeID]">
380 <ul class="tocnode"> <xsl:apply-templates select="documentNode[@nodeID]">
381 <xsl:with-param name="collName" select="$collName"/>
382 <xsl:with-param name="ec" select="$ec"/>
383 <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"/>
384 <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
385 </xsl:apply-templates>
386 </ul>
387 </xsl:if>
388 </li>
389 </xsl:template>
390
391 <!-- default content is to print the title and content of any documentNodes that have nodeContent -->
392 <xsl:template name="documentContent">
393 <div class="documenttext">
394 <xsl:choose>
395 <xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
396 <xsl:otherwise>
397 <xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>
398 </xsl:otherwise>
399 </xsl:choose>
400 </div>
401 </xsl:template>
402
403 <xsl:template match="documentNode" mode="content">
404 <xsl:if test="nodeContent">
405 <xsl:if test="metadataList/metadata[@name='Title']">
406 <h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
407 </xsl:if>
408 <xsl:apply-templates select="nodeContent"/>
409 </xsl:if>
410 </xsl:template>
411
412 <!-- the actual text/content -->
413 <xsl:template match="nodeContent">
414 <p/>
415 <xsl:for-each select="node()">
416 <xsl:choose>
417 <xsl:when test="not(name())">
418 <xsl:value-of select="." disable-output-escaping="yes"/>
419 </xsl:when>
420 <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
421 </xsl:choose>
422 </xsl:for-each>
423 </xsl:template>
424
425 <xsl:template name="xmldocumentContentPeeling">
426 <xsl:choose>
427 <xsl:when test="@docType='simple'">
428 <xsl:apply-templates select="nodeContent"/>
429 </xsl:when>
430 <xsl:otherwise>
431 <xsl:call-template name="xmlpeelingContents" />
432 </xsl:otherwise>
433 </xsl:choose>
434 </xsl:template>
435
436 <xsl:template name="xmlpeelingContents">
437 <xsl:if test="documentNode">
438 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
439 </xsl:if>
440 </xsl:template>
441
442 <xsl:template match="documentNode" mode="xmlpeeling">
443 <!-- get title -->
444 <xsl:choose>
445 <xsl:when test="nodeContent">
446 <xsl:text disable-output-escaping="yes">
447 &lt;Section&gt;
448 &lt;Description&gt;
449 &lt;Metadata name="Title"&gt;
450 </xsl:text>
451 <xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
452 <xsl:text disable-output-escaping="yes">
453 &lt;/Metadata&gt;
454 &lt;/Description&gt;
455 </xsl:text>
456 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
457 <xsl:text disable-output-escaping="yes">&lt;/Sec&gt;</xsl:text>
458 </xsl:when>
459 </xsl:choose>
460
461 <!-- recurse to the children -->
462 <xsl:if test="documentNode">
463 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
464 </xsl:if>
465
466 <!-- end the section -->
467 <xsl:text disable-output-escaping="yes">
468 &lt;/Section&gt;
469 </xsl:text>
470 </xsl:template>
471
472 <!-- match any file nodes -->
473 <xsl:template match="file">
474 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
475 <xsl:choose>
476 <xsl:when test="util:isImage(@mimeType)">
477 <img src="{$httpPath}/{@href}"/>
478 </xsl:when>
479 <xsl:otherwise>
480 <a href="{$httpPath}/{@href}"><xsl:value-of select="@href"/></a>
481 </xsl:otherwise>
482 </xsl:choose>
483 </xsl:template>
484
485 <!-- match any link nodes -->
486 <xsl:template match="link">
487 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
488 <xsl:variable name="actionargs">
489 <xsl:choose>
490 <xsl:when test="@type='document'">a=d</xsl:when>
491 <xsl:when test="@type='query'">a=q&amp;s=<xsl:value-of select="@service"/>&amp;rt=rd</xsl:when>
492 <xsl:otherwise>
493 p
494 </xsl:otherwise>
495 </xsl:choose>
496 </xsl:variable>
497 <xsl:variable name="serviceargs">
498 <xsl:for-each select="param">&amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
499 </xsl:variable>
500 <a href="{$library_name}?{$actionargs}&amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
501 </xsl:template>
502
503 <!-- match any annotations and make them span elements -->
504 <xsl:template match="annotation">
505 <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
506 </xsl:template>
507
508 <!-- paged naviagtion : INCOMPLETE!!-->
509 <xsl:template name="pagedContents">
510 <xsl:param name="collName"/>
511 <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
512 <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
513 <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
514 <table>
515 <xsl:choose>
516 <xsl:when test="$pos=-1"><!-- a doc -->
517 <tr valign="top">
518 <td align="left">
519 </td>
520 <td align="center"><center>
521 <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.pages', $children)"/></b>
522 </center></td>
523 <td align="right">
524 <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.fc"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
525 </td>
526 </tr>
527 </xsl:when>
528
529 <xsl:otherwise> <!-- an internal node -->
530 <tr valign="top">
531 <td align="left">
532 <xsl:if test=" not ( $pos = 1 )">
533 <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ps"><img src="interfaces/default/images/less.gif" border="0" align="absbottom" /></a>
534 </xsl:if>
535 </td>
536 <td align="center"><center>
537 <b><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.pageof', concat($pos, ';', $length))"/></b>
538 </center></td>
539 <td align="right">
540 <xsl:if test=" not($pos = $length)">
541 <a href="{$library_name}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ns"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
542 </xsl:if>
543 </td>
544 </tr>
545 </xsl:otherwise>
546 </xsl:choose>
547 <tr valign="middle">
548 <td align='center' valign='top' colspan='3'>
549 <form name="GotoForm" method="get" action="{$library_name}">
550 <input type='hidden' name='a' value='d'/>
551 <input type='hidden' name='c' value='{$collName}'/>
552 <input type='hidden' name='d' value='{@selectedNode}'/>
553 <input type="text" name="gp" size="3" maxlength="4"/>
554 <input type="submit"><xsl:attribute name='value'><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'document.gotopage')"/></xsl:attribute></input>
555 </form>
556 </td>
557 </tr>
558 </table>
559 </xsl:template>
560
561 <xsl:template name="enrichServices">
562 <xsl:param name="collName"/>
563 <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
564 <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
565 <xsl:for-each select="../serviceList/service">
566 <table border='1' cellspacing='0'>
567 <tr><td>
568 <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
569 <form name="EnrichForm" method="get" action="{$library_name}">
570 <xsl:apply-templates select="paramList"/>
571 <input type='hidden' name='a' value='d'/>
572 <input type='hidden' name='d' value='{$docID}'/>
573 <input type='hidden' name='c' value='{$collName}'/>
574 <xsl:if test='$request-params/param[@name="sib"]'>
575 <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if>
576 <input type='hidden' name='s' value='{@name}'/>
577 <input type='hidden' name='p.a'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.a"]'/></xsl:attribute></input>
578 <input type='hidden' name='p.sa'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.sa"]'/></xsl:attribute></input>
579 <input type='hidden' name='p.s'><xsl:attribute name='value'><xsl:value-of select='$request-params/param[@name="p.s"]'/></xsl:attribute></input>
580 <input type='hidden' name='end' value='1'/>
581 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
582 </form>
583 </td></tr>
584 </table>
585 </xsl:for-each>
586 </xsl:template>
587
588 <xsl:template match="paramList" mode="hidden">
589 <xsl:for-each select="param">
590 <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
591 </xsl:text>
592 </xsl:for-each>
593 </xsl:template>
594
595 <xsl:template name="documentArrows">
596 <xsl:param name="collName"/>
597 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
598
599 <div class="documentarrows">
600 <xsl:if test="not(string($ed)='1')">
601 <xsl:call-template name="documentArrow">
602 <xsl:with-param name="collName" select="$collName"/>
603 <xsl:with-param name="direction">back</xsl:with-param>
604 </xsl:call-template>
605 <xsl:call-template name="documentArrow">
606 <xsl:with-param name="collName" select="$collName"/>
607 <xsl:with-param name="direction">forward</xsl:with-param>
608 </xsl:call-template>
609 </xsl:if>
610 </div>
611
612 </xsl:template>
613
614 <xsl:template name="documentArrow">
615 <xsl:param name="collName"/>
616 <xsl:param name="direction"/>
617 <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
618 <xsl:if test='$request-params/param[@name="dt"]/@value != "simple"'>
619 <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><xsl:when test="$direction='back'"><img class="lessarrow" src="interfaces/default/images/less.gif" /></xsl:when><xsl:otherwise><img class="morearrow" src="interfaces/default/images/more.gif" /></xsl:otherwise></xsl:choose></a>
620 </xsl:if>
621 </xsl:template>
622
623 <xsl:template name="externalPage">
624 <xsl:param name="external"/>
625 <h2>External Link</h2>
626 <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.
627 </p>
628 </xsl:template>
629
630</xsl:stylesheet>
631
632
633
634
Note: See TracBrowser for help on using the repository browser.