source: trunk/gsdl3/web/interfaces/default/transform/document.xsl@ 13996

Last change on this file since 13996 was 13996, checked in by lh92, 15 years ago

Added code to display the page turning when book switch is on and the tidy_option is set

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