source: main/trunk/greenstone3/web/interfaces/basic-client-xslt/transform/document.xsl@ 32388

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

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

  • 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 <xsl:call-template name="documentArrows">
170 <xsl:with-param name="collName" select="$collName"/>
171 </xsl:call-template>
172 <xsl:call-template name="documentContent">
173 <xsl:with-param name="collName" select="$collName"/>
174 </xsl:call-template>
175 <xsl:call-template name="documentArrows">
176 <xsl:with-param name="collName" select="$collName"/>
177 </xsl:call-template>
178 </xsl:otherwise>
179 </xsl:choose>
180 </xsl:otherwise>
181 </xsl:choose>
182 </xsl:template>
183
184 <xsl:template name="documentHeading">
185 <xsl:param name="collName"/>
186 <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
187 <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
188 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
189 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
190 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
191 <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>
192 <div id="documentheading">
193 <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">
194 <xsl:call-template name="openbookimg">
195 <xsl:with-param name="title"><xsl:value-of select="'close_book'"/></xsl:with-param>
196 </xsl:call-template>
197 </a>
198 <xsl:choose>
199 <xsl:when test="@docType='simple'">
200 <xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/>
201 </xsl:when>
202 <xsl:otherwise>
203 <xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/>
204 </xsl:otherwise>
205 </xsl:choose>
206 </div>
207
208 <div id="docheadwrapper">
209 <div id="documentinfo">
210
211 <xsl:choose>
212 <xsl:when test="$bookswitch = 'on'">
213 <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
214 <div id="headingimage">
215 <xsl:call-template name="coverImage"/>
216 </div>
217 </xsl:if>
218 </xsl:when>
219 <xsl:otherwise>
220 <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
221 <div id="headingimage">
222 <xsl:call-template name="coverImage"/>
223 </div>
224 </xsl:if>
225
226 <ul id="docbuttons" >
227 <xsl:call-template name="documentButtons">
228 <xsl:with-param name="collName" select="$collName"/>
229 </xsl:call-template>
230 </ul>
231 </xsl:otherwise>
232 </xsl:choose>
233 </div>
234 <!--<div><xsl:call-template name="enrichServices">
235 <xsl:with-param name="collName" select="$collName"/>
236 </xsl:call-template></div>-->
237 <xsl:if test="$bookswitch = 'off'">
238 <xsl:if test="string($doTOC) != 'false'">
239 <div id="toc">
240 <xsl:call-template name="TOC">
241 <xsl:with-param name="collName" select="$collName"/>
242 </xsl:call-template>
243 </div>
244 </xsl:if>
245 </xsl:if>
246 </div>
247 </xsl:template>
248
249 <xsl:template name="coverImage">
250 <xsl:choose>
251 <xsl:when test="$bookswitch = 'on'">
252 <script type="text/javascript">
253 <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>
254 </script>
255 </xsl:when>
256 <xsl:otherwise>
257 <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>
258 </xsl:otherwise>
259 </xsl:choose>
260 </xsl:template>
261
262 <xsl:template name="documentButtons">
263 <xsl:param name="collName"/>
264 <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
265 <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
266 <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
267 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
268
269
270 <!-- expand document -->
271 <xsl:if test="@docType = 'hierarchy' or @docType = 'paged'">
272 <li>
273 <xsl:choose>
274 <xsl:when test="string($ed)='1'">
275 <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>
276 </xsl:when>
277 <xsl:otherwise>
278 <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>
279 </xsl:otherwise>
280 </xsl:choose>
281 </li>
282 </xsl:if>
283
284 <!-- expand contents -->
285 <xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
286 <li>
287 <xsl:choose>
288 <xsl:when test="string($ec)='1'">
289 <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>
290 </xsl:when>
291 <xsl:otherwise>
292 <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>
293 </xsl:otherwise>
294 </xsl:choose>
295 </li>
296 </xsl:if>
297
298 <!-- detach page -->
299 <xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
300 <li>
301 <a target="_blank" class="getTextFor doc.detach_page_b this.title.doc.detach_page_tip">
302 <xsl:attribute name="href">
303 <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"/>
304 </xsl:attribute>
305 </a>
306 </li>
307 </xsl:template>
308
309 <xsl:template name="TOC">
310 <xsl:param name="collName"/>
311 <xsl:choose>
312 <xsl:when test="@docType='hierarchy'">
313 <xsl:call-template name="hierarchicalContents">
314 <xsl:with-param name="collName" select="$collName"/>
315 </xsl:call-template>
316 </xsl:when>
317 <xsl:when test="@docType='paged'">
318 <xsl:call-template name="pagedContents">
319 <xsl:with-param name="collName" select="$collName"/>
320 </xsl:call-template>
321 </xsl:when>
322 </xsl:choose>
323 </xsl:template>
324
325 <xsl:template name="hierarchicalContents">
326 <xsl:param name="collName"/>
327 <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
328 <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
329 <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
330 <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
331 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
332 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
333 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
334 <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>
335 <script type="text/javascript">
336 <xsl:text>
337 // Load up the initial document using AJAX!
338 var initialHash = '</xsl:text>
339 <xsl:value-of select="$d" /><xsl:text>';
340 </xsl:text>
341 </script>
342 <xsl:if test="documentNode[@nodeID]">
343 <ul id="tocnodes">
344 <li id="tocstart">
345 <xsl:choose>
346 <xsl:when test="string($oc)='0'">
347 <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>
348 </xsl:when>
349 <xsl:otherwise>
350 <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>
351 </xsl:otherwise>
352 </xsl:choose>
353 <span class="getTextFor doc.table_of_contents">&amp;amp;nbsp;</span>
354 <xsl:if test="string($oc)!='0'">
355 <ul class="tocnode">
356 <xsl:for-each select="documentNode/documentNode[@nodeID]">
357 <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>
358 </xsl:for-each>
359 </ul>
360 </xsl:if>
361 </li>
362 </ul>
363 </xsl:if>
364 </xsl:template>
365
366 <!-- each icon-title pair is a row in a table. children go in a table in another row -->
367 <xsl:template match="documentNode">
368 <xsl:param name="collName"/>
369 <xsl:param name="ec"/>
370 <xsl:param name="p.a"/>
371 <xsl:param name="p.s"/>
372 <xsl:param name="p.sa"/>
373 <xsl:param name="p.c"/>
374 <!-- Display the appropriate image, depending on the node type -->
375 <li>
376 <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>
377 <xsl:apply-templates select="." mode="displayNodeIcon"/>
378 </a>
379
380 <!-- Display associated title, bolded if the node has content -->
381 <xsl:choose>
382 <xsl:when test="nodeContent">
383 <span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
384 </xsl:when>
385 <xsl:otherwise>
386 <span><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
387 </xsl:otherwise>
388 </xsl:choose>
389 <!-- Apply recursively to the children of this node -->
390 <xsl:if test="documentNode[@nodeID]">
391 <ul class="tocnode">
392 <xsl:apply-templates select="documentNode[@nodeID]">
393 <xsl:with-param name="collName" select="$collName"/>
394 <xsl:with-param name="ec" select="$ec"/>
395 <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"/>
396 <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
397 </xsl:apply-templates>
398 </ul>
399 </xsl:if>
400 </li>
401 </xsl:template>
402
403 <!-- default content is to print the title and content of any documentNodes that have nodeContent -->
404 <xsl:template name="documentContent">
405 <div class="documenttext">
406 <xsl:choose>
407 <xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
408 <xsl:otherwise>
409 <!--<xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>-->
410 </xsl:otherwise>
411 </xsl:choose>
412 </div>
413 </xsl:template>
414
415 <xsl:template match="documentNode" mode="content">
416 <xsl:if test="nodeContent">
417 <xsl:if test="metadataList/metadata[@name='Title']">
418 <h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
419 </xsl:if>
420 <xsl:apply-templates select="nodeContent"/>
421 </xsl:if>
422 </xsl:template>
423
424 <!-- the actual text/content -->
425 <xsl:template match="nodeContent">
426 <xsl:for-each select="node()">
427 <xsl:choose>
428 <xsl:when test="not(name())">
429 <xsl:value-of select="." disable-output-escaping="yes" />
430 </xsl:when>
431 <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
432 </xsl:choose>
433 </xsl:for-each>
434 </xsl:template>
435
436 <xsl:template name="xmldocumentContentPeeling">
437 <xsl:choose>
438 <xsl:when test="@docType='simple'">
439 <xsl:apply-templates select="nodeContent"/>
440 </xsl:when>
441 <xsl:otherwise>
442 <xsl:call-template name="xmlpeelingContents" />
443 </xsl:otherwise>
444 </xsl:choose>
445 </xsl:template>
446
447 <xsl:template name="xmlpeelingContents">
448 <xsl:if test="documentNode">
449 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
450 </xsl:if>
451 </xsl:template>
452
453 <xsl:template match="documentNode" mode="xmlpeeling">
454 <!-- get title -->
455 <xsl:if test="nodeContent">
456 <xsl:text disable-output-escaping="yes">
457 &lt;Section&gt;
458 &lt;Description&gt;
459 &lt;Metadata name="Title"&gt;
460 </xsl:text>
461 <xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
462 <xsl:text disable-output-escaping="yes">
463 &lt;/Metadata&gt;
464 &lt;/Description&gt;
465 </xsl:text>
466 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
467 <xsl:text disable-output-escaping="yes">
468 &lt;/Section&gt;
469 </xsl:text>
470 </xsl:if>
471
472 <!-- recurse to the children -->
473 <xsl:if test="documentNode">
474 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
475 </xsl:if>
476
477 <xsl:if test="nodeContent">
478 <!-- end the section -->
479 <xsl:text disable-output-escaping="yes">
480 &amp;lt;/Section&amp;gt;
481 </xsl:text>
482 </xsl:if>
483 </xsl:template>
484
485 <!-- match any file nodes -->
486 <xsl:template match="file">
487 <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
488 <xsl:choose>
489 <xsl:when test="starts-with(@mimeType, 'image/')">
490 <img src="{$httpPath}/{@href}"/>
491 </xsl:when>
492 <xsl:otherwise>
493 <a href="{$httpPath}/{@href}"><xsl:value-of select="@href"/></a>
494 </xsl:otherwise>
495 </xsl:choose>
496 </xsl:template>
497
498 <!-- match any link nodes -->
499 <xsl:template match="link">
500 <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/>
501 <xsl:variable name="actionargs">
502 <xsl:choose>
503 <xsl:when test="@type='document'">a=d</xsl:when>
504 <xsl:when test="@type='query'">a=q&amp;amp;s=<xsl:value-of select="@service"/>&amp;amp;rt=rd</xsl:when>
505 <xsl:otherwise>
506 p
507 </xsl:otherwise>
508 </xsl:choose>
509 </xsl:variable>
510 <xsl:variable name="serviceargs">
511 <xsl:for-each select="param">&amp;amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
512 </xsl:variable>
513 <a href="{$library_name}?{$actionargs}&amp;amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
514 </xsl:template>
515
516 <!-- match any annotations and make them span elements -->
517 <xsl:template match="annotation">
518 <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
519 </xsl:template>
520
521 <!-- paged naviagtion : INCOMPLETE!!-->
522 <xsl:template name="pagedContents">
523 <xsl:param name="collName"/>
524 <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
525 <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
526 <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
527 <table>
528 <xsl:choose>
529 <xsl:when test="$pos=-1"><!-- a doc -->
530 <tr valign="top">
531 <td align="left">
532 </td>
533 <td align="center">
534 <center>
535 <b class="getTextFor doc.pages"></b>
536 </center>
537 </td>
538 <td align="right">
539 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.fc"><img src="interfaces/basic/images/more.gif" border="0" align="absbottom" /></a>
540 </td>
541 </tr>
542 </xsl:when>
543
544 <xsl:otherwise> <!-- an internal node -->
545 <tr valign="top">
546 <td align="left">
547 <xsl:if test=" not ( $pos = 1 )">
548 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ps"><img src="interfaces/basic/images/less.gif" border="0" align="absbottom" /></a>
549 </xsl:if>
550 </td>
551 <td align="center">
552 <center>
553 <b><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.doc.pageof|', $pos, ';', $length)"/></xsl:attribute></b>
554 </center>
555 </td>
556 <td align="right">
557 <xsl:if test=" not($pos = $length)">
558 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ns"><img src="interfaces/basic/images/more.gif" border="0" align="absbottom" /></a>
559 </xsl:if>
560 </td>
561 </tr>
562 </xsl:otherwise>
563 </xsl:choose>
564 <tr valign="middle">
565 <td align='center' valign='top' colspan='3'>
566 <form name="GotoForm" method="get" action="{$library_name}">
567 <input type='hidden' name='a' value='d'/>
568 <input type='hidden' name='c' value='{$collName}'/>
569 <input type='hidden' name='d' value='{@selectedNode}'/>
570 <input type="text" name="gp" size="3" maxlength="4"/>
571 <input type="submit" class="getTextFor null this.value.doc.gotopage"></input>
572 </form>
573 </td>
574 </tr>
575 </table>
576 </xsl:template>
577
578 <xsl:template name="enrichServices">
579 <xsl:param name="collName"/>
580 <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
581 <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
582 <xsl:for-each select="../serviceList/service">
583 <table border='1' cellspacing='0'>
584 <tr><td>
585 <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
586 <form name="EnrichForm" method="get" action="{$library_name}">
587 <xsl:apply-templates select="paramList"/>
588 <input type="hidden" name="a" value="d"/>
589 <input type="hidden" name="d" value="{$docID}"/>
590 <input type="hidden" name="c" value="{$collName}"/>
591 <xsl:if test="$request-params/param[@name='sib']">
592 <input type="hidden" name="sib"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='sib']/@value"/></xsl:attribute></input></xsl:if>
593 <input type="hidden" name="s" value="{@name}"/>
594 <input type="hidden" name="p.a"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.a']"/></xsl:attribute></input>
595 <input type="hidden" name="p.sa"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.sa']"/></xsl:attribute></input>
596 <input type="hidden" name="p.s"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.s']"/></xsl:attribute></input>
597 <input type="hidden" name="end" value='1'/>
598 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
599 </form>
600 </td></tr>
601 </table>
602 </xsl:for-each>
603 </xsl:template>
604
605 <xsl:template match="paramList" mode="hidden">
606 <xsl:for-each select="param">
607 <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
608 </xsl:text>
609 </xsl:for-each>
610 </xsl:template>
611
612 <xsl:template name="documentArrows">
613 <xsl:param name="collName"/>
614 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
615
616 <div class="documentarrows">
617 <xsl:if test="not(string($ed)='1')">
618 <xsl:call-template name="documentArrow">
619 <xsl:with-param name="collName" select="$collName"/>
620 <xsl:with-param name="direction">back</xsl:with-param>
621 </xsl:call-template>
622 <xsl:call-template name="documentArrow">
623 <xsl:with-param name="collName" select="$collName"/>
624 <xsl:with-param name="direction">forward</xsl:with-param>
625 </xsl:call-template>
626 </xsl:if>
627 </div>
628
629 </xsl:template>
630
631 <xsl:template name="documentArrow">
632 <xsl:param name="collName"/>
633 <xsl:param name="direction"/>
634 <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
635 <xsl:if test="$request-params/param[@name='dt']/@value != 'simple'">
636 <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/basic/images/less.gif" /></xsl:when><xsl:otherwise><img class="morearrow" src="interfaces/basic/images/more.gif" /></xsl:otherwise></xsl:choose></a>
637 </xsl:if>
638 </xsl:template>
639
640 <xsl:template name="externalPage">
641 <xsl:param name="external"/>
642 <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>
643 <h2 class="getTextFor external.title"></h2>
644 <p><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.external.text|', $go_forward_link)" /></xsl:attribute>
645 </p>
646 </xsl:template>
647
648</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.