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

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

renaming interfaces. step 1. rename default to basic. change image paths, interface inheritance etc

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