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

Last change on this file since 24009 was 24009, checked in by sjm84, 13 years ago

Another round of improvements to the oran skin including a tree view of the classifiers

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