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

Last change on this file since 14540 was 14540, checked in by anna, 16 years ago

Don't display document arrows when document is expanded.

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