source: main/trunk/greenstone3/web/interfaces/basic/transform/document.xsl@ 32127

Last change on this file since 32127 was 25843, checked in by kjdon, 12 years ago

if book is not defined then we need to set the bookswitch variable to off

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