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

Last change on this file since 14578 was 14578, checked in by qq6, 17 years ago

optimized some codes for the external link

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