source: greenstone3/trunk/web/interfaces/oran/transform/document.xsl@ 18617

Last change on this file since 18617 was 18617, checked in by oranfry, 15 years ago

a sample skin in progress

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