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

Last change on this file since 18316 was 18316, checked in by kjdon, 15 years ago

indented the xml nicely.

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