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

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

moved hard coded text into property files

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