source: main/branches/64_bit_Greenstone/greenstone3/web/interfaces/default/transform/document.xsl@ 24007

Last change on this file since 24007 was 24007, checked in by sjm84, 13 years ago

Updating this branch to match the latest Greenstone3 changes

  • Property svn:keywords set to Author Date Id Revision
File size: 29.2 KB
RevLine 
[4047]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
[4712]3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
[9874]5 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
[24007]6 extension-element-prefixes="java"
7 exclude-result-prefixes="java gsf">
[4047]8
[17017]9 <!-- style includes global params interface_name, library_name -->
[4712]10 <xsl:include href="style.xsl"/>
11 <xsl:include href="service-params.xsl"/>
[12015]12 <xsl:include href="berrytools.xsl"/>
13
[4712]14 <xsl:output method="html"/>
[17017]15
16 <!-- the main page layout template is here -->
17 <xsl:template match="page">
18 <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
19 <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
20
21 <xsl:choose>
22 <xsl:when test="$bookswitch = 'flashxml' and $a = 'd'">
[18316]23 <html>
24 <xsl:call-template name="response" />
[17017]25 </html>
26 </xsl:when>
27
28 <xsl:otherwise>
29 <html>
[18316]30 <head>
31 <title>
32 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
33 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
34 </title>
35 <xsl:call-template name="globalStyle"/>
36 <xsl:call-template name="pageStyle"/>
37 </head>
[17017]38 <body>
[18388]39 <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
40 <div id="page-wrapper">
[18316]41 <xsl:call-template name="response" />
42 <xsl:call-template name="greenstoneFooter"/>
43 </div>
[17017]44 </body>
45 </html>
46 </xsl:otherwise>
47 </xsl:choose>
48 </xsl:template>
49
50
[18316]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>
[4877]53
[8526]54 <xsl:template name="pageTitle">
[4712]55 <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
[24007]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>
[4047]57 </xsl:template>
58
[4253]59 <!-- this is hard coded for GATE, should somehow do it dynamically-->
[8526]60 <xsl:template name="pageStyle">
[4047]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 }
[4288]67 span.query_term {display: inline; background-color : yellow }
[4047]68 </xsl:text>
69 </style>
[24007]70
[18316]71 <!--TODO: add berry basket switch-->
72 <!--<xsl:if test="$berryBaskets = 'true'">-->
[12152]73 <xsl:if test="$berrybasketswitch = 'on'">
[18316]74 <xsl:call-template name="berryStyleSheet"/>
75 <xsl:call-template name="js-library"/>
[12152]76 </xsl:if>
[4047]77 </xsl:template>
[4253]78
[4047]79 <xsl:template match="pageResponse">
[4712]80 <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
[13996]81 <xsl:choose>
82 <xsl:when test="$bookswitch = 'on' or $bookswitch = 'off'">
83 <xsl:call-template name="standardPageBanner">
[18316]84 <xsl:with-param name="collName" select="$collName"/>
[13996]85 </xsl:call-template>
86 <xsl:call-template name="navigationBar">
[18316]87 <xsl:with-param name="collName" select="$collName"/>
[13996]88 </xsl:call-template>
[18316]89
[13996]90 <!--<xsl:if test="$berryBaskets = 'true'">-->
91 <xsl:if test="$berrybasketswitch = 'on'">
92 <xsl:call-template name="documentBerryBasket">
[18316]93 <xsl:with-param name="collName" select="$collName"/>
94 <xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
95 <xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
96 <xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
[13996]97 </xsl:call-template>
98 </xsl:if>
99 </xsl:when>
[18316]100 </xsl:choose>
[13267]101
[18316]102 <!-- display the document -->
[13996]103 <xsl:if test="$bookswitch != 'flashxml'">
[18316]104 <xsl:text disable-output-escaping="yes">&lt;div id="content"&gt;</xsl:text>
[13996]105 </xsl:if>
[5690]106 <xsl:apply-templates select="document">
107 <xsl:with-param name="collName" select="$collName"/>
108 </xsl:apply-templates>
[13996]109 <xsl:if test="$bookswitch != 'flashxml'">
[18316]110 <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
[13996]111 </xsl:if>
[4253]112 </xsl:template>
[18316]113
[4712]114 <xsl:template match="document">
[18316]115 <xsl:param name="collName"/>
116 <xsl:variable name="external"><xsl:value-of select="/page/pageResponse/document/@external"/></xsl:variable>
[14578]117 <xsl:choose>
118 <xsl:when test="$external != ''">
[18316]119 <xsl:call-template name="externalPage">
120 <xsl:with-param name="external" select="$external"/>
121 </xsl:call-template>
[14578]122 </xsl:when>
123 <xsl:otherwise>
[18437]124 <xsl:choose>
125 <xsl:when test="$bookswitch = 'flashxml'">
[18316]126 <xsl:call-template name="xmldocumentContentPeeling">
127 <xsl:with-param name="collName" select="$collName"/>
128 </xsl:call-template>
[18437]129 </xsl:when>
[18316]130
[18437]131 <xsl:when test="$bookswitch = 'on'">
[18316]132 <xsl:call-template name="documentHeading">
133 <xsl:with-param name="collName" select="$collName"/>
134 </xsl:call-template>
135 <div id="bookdiv"></div>
136 <script type="text/javascript">
137 <xsl:text disable-output-escaping="yes">
138 var doc_url = document.URL;
[24007]139 doc_url = doc_url.replace(/(&amp;amp;|\?)book=[a-z]+/gi,'');
140 doc_url += '&amp;amp;book=flashxml';
[13996]141
[18316]142 var flash_plug_html = ""
[24007]143 flash_plug_html += '&amp;lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
[18316]144 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
145 flash_plug_html += ' height="100%" id="Book" swLiveConnect="true" \n';
[24007]146 flash_plug_html += ' width="100%"&amp;gt;\n';
147 flash_plug_html += ' &amp;lt;PARAM name="allowScriptAccess" value="always" /&amp;gt;\n';
148 flash_plug_html += ' &amp;lt;PARAM name="movie" value="Book.swf';
[18316]149 flash_plug_html += '?src_image=' + escape(img_cover);
[24007]150 flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url)
151 flash_plug_html += '" /&amp;gt;\n';
152 flash_plug_html += ' &amp;lt;PARAM name="quality" value="high" /&amp;gt;\n';
153 flash_plug_html += ' &amp;lt;PARAM name="bgcolor" value="#FFFFFF" /&amp;gt;\n';
154 flash_plug_html += ' &amp;lt;EMBED align="middle" \n';
[18316]155 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \n';
156 flash_plug_html += ' bgcolor="#FFFFFF" height="100%" name="Book" \n';
157 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
158 flash_plug_html += ' quality="high" \n';
159 flash_plug_html += ' src="Book.swf';
160 flash_plug_html += '?src_image=' + escape(img_cover);
[24007]161 flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url);
[18316]162 flash_plug_html += '"\n';
[24007]163 flash_plug_html += ' type="application/x-shockwave-flash" width="100%" /&amp;gt;\n';
164 flash_plug_html += '&amp;lt;/OBJECT&amp;gt;\n';
[18316]165 var flash_div = document.getElementById("bookdiv");
166 flash_div.innerHTML = flash_plug_html;
167 </xsl:text>
168 </script>
[18437]169 </xsl:when>
170 <xsl:otherwise>
171 <xsl:call-template name="documentHeading">
172 <xsl:with-param name="collName" select="$collName"/>
173 </xsl:call-template>
174
175 <xsl:call-template name="documentArrows">
176 <xsl:with-param name="collName" select="$collName"/>
177 </xsl:call-template>
178 <xsl:call-template name="documentContent">
179 <xsl:with-param name="collName" select="$collName"/>
180 </xsl:call-template>
181 <xsl:call-template name="documentArrows">
182 <xsl:with-param name="collName" select="$collName"/>
183 </xsl:call-template>
184 </xsl:otherwise>
185 </xsl:choose>
186
[18316]187 </xsl:otherwise>
[14578]188 </xsl:choose>
[18316]189 </xsl:template>
[4047]190
[4712]191 <xsl:template name="documentHeading">
192 <xsl:param name="collName"/>
[5690]193 <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
[8006]194 <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
[5690]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"/>
[9008]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>
[18316]199 <div id="documentheading">
[24007]200 <a href="{$library_name}?a={$p.a}&amp;amp;sa={$p.sa}&amp;amp;s={$p.s}&amp;amp;c={$p.c}&amp;amp;rt=rd"><xsl:call-template name="openbookimg"><xsl:with-param name="title"><xsl:value-of select="'close_book'"/></xsl:with-param>
[18316]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>
[13996]204
[18316]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>
[13831]230 </div>
[18316]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>
[5690]245
[4712]246 <xsl:template name="coverImage">
[18316]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>
[24007]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>
[18316]255 </xsl:otherwise>
256 </xsl:choose>
[4712]257 </xsl:template>
[4047]258
[5690]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"/>
[5695]264 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
[8508]265
[18316]266
267 <!-- expand document -->
268 <xsl:if test="@docType = 'hierarchy' or @docType = 'paged'">
269 <li>
[13505]270 <xsl:choose><xsl:when test="string($ed)='1'">
[24007]271 <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=0" class="getTextFor doc.contract_doc_b this.title.doc.contract_doc_tip"></a>
[18316]272 </xsl:when>
273 <xsl:otherwise>
[24007]274 <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=1" class="getTextFor doc.expand_doc_b this.title.doc.expand_doc_tip"></a>
[18316]275 </xsl:otherwise>
276 </xsl:choose>
277 </li>
278 </xsl:if>
279
280 <!-- expand contents -->
281 <xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
[13505]282 <li>
[18316]283 <xsl:choose><xsl:when test="string($ec)='1'">
[24007]284 <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=0" class="getTextFor doc.contract_contents_b this.title.doc.contract_contents_tip"></a>
[18316]285 </xsl:when>
286 <xsl:otherwise>
[24007]287 <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=1" class="getTextFor doc.expand_contents_b this.title.doc.expand_contents_tip"></a>
[18316]288 </xsl:otherwise>
289 </xsl:choose>
290 </li>
291 </xsl:if>
[13267]292
[18316]293 <!-- detach page -->
294 <xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
295 <li>
[24007]296 <a target="_blank" class="getTextFor doc.detach_page_b this.title.doc.detach_page_tip"><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;d=<xsl:value-of select="$docID"/>&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;sib=<xsl:value-of select="$sib"/>&amp;amp;dt=<xsl:value-of select="$paramList/param[@name='dt']/@value"/>&amp;amp;ec=<xsl:value-of select="$paramList/param[@name='ec']/@value"/>&amp;amp;et=<xsl:value-of select="$paramList/param[@name='et']/@value"/>&amp;amp;p.a=<xsl:value-of select="$paramList/param[@name='p.a']/@value"/>&amp;amp;p.s=<xsl:value-of select="$paramList/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$paramList/param[@name='p.sa']/@value"/></xsl:attribute></a></li>
[18316]297 </xsl:template>
[5690]298
[4712]299 <xsl:template name="TOC">
[4253]300 <xsl:param name="collName"/>
[4712]301 <xsl:choose>
[4900]302 <xsl:when test="@docType='hierarchy'">
[4712]303 <xsl:call-template name="hierarchicalContents">
304 <xsl:with-param name="collName" select="$collName"/>
305 </xsl:call-template>
306 </xsl:when>
[4900]307 <xsl:when test="@docType='paged'">
[4712]308 <xsl:call-template name="pagedContents">
309 <xsl:with-param name="collName" select="$collName"/>
310 </xsl:call-template>
311 </xsl:when>
312 </xsl:choose>
[4253]313 </xsl:template>
[18316]314
[4712]315 <xsl:template name="hierarchicalContents">
[4253]316 <xsl:param name="collName"/>
[5690]317 <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
318 <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
319 <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
[5699]320 <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
[11017]321 <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
322 <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
323 <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
324 <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>
[24007]325 <script type="text/javascript">
326 <xsl:text>
327 // Load up the initial document using AJAX!
328 var initialHash = '</xsl:text>
329 <xsl:value-of select="$d" /><xsl:text>';
330 </xsl:text>
331 </script>
332 <xsl:if test="documentNode[@nodeID]">
[13505]333 <ul id="tocnodes">
[24007]334 <li id="tocstart">
[18316]335 <xsl:choose><xsl:when test="string($oc)='0'">
[24007]336 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=1&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="closedfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.open_toc'"/></xsl:with-param></xsl:call-template></a>
[18316]337 </xsl:when>
[24007]338 <xsl:otherwise><a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=0&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="openfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.close_toc'"/></xsl:with-param></xsl:call-template></a></xsl:otherwise></xsl:choose><span class="getTextFor doc.table_of_contents">&amp;amp;nbsp;</span>
[18316]339 <xsl:if test="string($oc)!='0'">
340 <ul class="tocnode">
341 <xsl:for-each select="documentNode/documentNode[@nodeID]">
342 <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>
343 </xsl:for-each>
[13505]344 </ul>
[18316]345 </xsl:if>
[13505]346 </li>
347 </ul>
[5690]348 </xsl:if>
[4253]349 </xsl:template>
350
[5690]351 <!-- each icon-title pair is a row in a table. children go in a table in another row -->
[4253]352 <xsl:template match="documentNode">
353 <xsl:param name="collName"/>
[5701]354 <xsl:param name="ec"/>
[11017]355 <xsl:param name="p.a"/>
356 <xsl:param name="p.s"/>
357 <xsl:param name="p.sa"/>
358 <xsl:param name="p.c"/>
[5690]359 <!-- Display the appropriate image, depending on the node type -->
[18316]360 <li>
[24007]361 <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;d=<xsl:value-of select="@nodeID"/><xsl:if test="documentNode">.pr</xsl:if>&amp;amp;sib=1<xsl:if test="string($ec) = '1'">&amp;amp;ec=1</xsl:if>&amp;amp;p.a=<xsl:value-of select="$p.a"/>&amp;amp;p.sa=<xsl:value-of select="$p.sa"/>&amp;amp;p.s=<xsl:value-of select="$p.s"/>&amp;amp;p.c=<xsl:value-of select="$p.c"/></xsl:attribute>
[18316]362 <xsl:apply-templates select="." mode="displayNodeIcon"/>
363 </a>
[5690]364
365 <!-- Display associated title, bolded if the node has content -->
[18316]366 <xsl:choose>
367 <xsl:when test="nodeContent">
368 <span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
369 </xsl:when>
370 <xsl:otherwise>
[24007]371 <span><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
[18316]372 </xsl:otherwise>
373 </xsl:choose>
374 <!-- Apply recursively to the children of this node -->
375 <xsl:if test="documentNode[@nodeID]">
376 <ul class="tocnode"> <xsl:apply-templates select="documentNode[@nodeID]">
377 <xsl:with-param name="collName" select="$collName"/>
378 <xsl:with-param name="ec" select="$ec"/>
379 <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"/>
380 <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
381 </xsl:apply-templates>
382 </ul>
383 </xsl:if>
[13505]384 </li>
[4253]385 </xsl:template>
386
[7760]387 <!-- default content is to print the title and content of any documentNodes that have nodeContent -->
[4712]388 <xsl:template name="documentContent">
[18316]389 <div class="documenttext">
390 <xsl:choose>
391 <xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
392 <xsl:otherwise>
[24007]393 <!--<xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>-->
[18316]394 </xsl:otherwise>
395 </xsl:choose>
396 </div>
[4712]397 </xsl:template>
398
[7760]399 <xsl:template match="documentNode" mode="content">
400 <xsl:if test="nodeContent">
401 <xsl:if test="metadataList/metadata[@name='Title']">
402 <h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
403 </xsl:if>
404 <xsl:apply-templates select="nodeContent"/>
405 </xsl:if>
406 </xsl:template>
[4047]407
[4712]408 <!-- the actual text/content -->
409 <xsl:template match="nodeContent">
[5690]410 <xsl:for-each select="node()">
411 <xsl:choose>
[13996]412 <xsl:when test="not(name())">
[24007]413 <xsl:value-of select="." disable-output-escaping="yes" />
[13996]414 </xsl:when>
[5690]415 <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
416 </xsl:choose>
417 </xsl:for-each>
[4712]418 </xsl:template>
[5119]419
[13996]420 <xsl:template name="xmldocumentContentPeeling">
[18316]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
[13996]431 <xsl:template name="xmlpeelingContents">
[18316]432 <xsl:if test="documentNode">
433 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
434 </xsl:if>
435 </xsl:template>
[13996]436
[18316]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">
[24007]442 &amp;lt;Section&amp;gt;
443 &amp;lt;Description&amp;gt;
444 &amp;lt;Metadata name="Title"&amp;gt;
[18316]445 </xsl:text>
446 <xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
447 <xsl:text disable-output-escaping="yes">
[24007]448 &amp;lt;/Metadata&amp;gt;
449 &amp;lt;/Description&amp;gt;
[18316]450 </xsl:text>
451 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
[24007]452 <xsl:text disable-output-escaping="yes">&amp;lt;/Sec&amp;gt;</xsl:text>
[18316]453 </xsl:when>
454 </xsl:choose>
[13996]455
[18316]456 <!-- recurse to the children -->
457 <xsl:if test="documentNode">
458 <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
459 </xsl:if>
[13996]460
[18316]461 <!-- end the section -->
462 <xsl:text disable-output-escaping="yes">
[24007]463 &amp;lt;/Section&amp;gt;
[18316]464 </xsl:text>
465 </xsl:template>
[13996]466
[8526]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>
[24007]471 <xsl:when test="starts-with(@mimeType, 'image/')">
[8526]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
[5119]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>
[24007]486 <xsl:when test="@type='query'">a=q&amp;amp;s=<xsl:value-of select="@service"/>&amp;amp;rt=rd</xsl:when>
[5119]487 <xsl:otherwise>
[18437]488 p
[5119]489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:variable>
492 <xsl:variable name="serviceargs">
[24007]493 <xsl:for-each select="param">&amp;amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
[18316]494 </xsl:variable>
[24007]495 <a href="{$library_name}?{$actionargs}&amp;amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
[5119]496 </xsl:template>
[4712]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>
[5690]502
[4712]503 <!-- paged naviagtion : INCOMPLETE!!-->
504 <xsl:template name="pagedContents">
[4047]505 <xsl:param name="collName"/>
[4712]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>
[24007]516 <b class="getTextFor doc.pages"></b>
[4712]517 </center></td>
518 <td align="right">
[24007]519 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.fc"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
[4712]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 )">
[24007]528 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ps"><img src="interfaces/default/images/less.gif" border="0" align="absbottom" /></a>
[4712]529 </xsl:if>
530 </td>
531 <td align="center"><center>
[24007]532 <b><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.doc.pageof|', $pos, ';', $length)"/></xsl:attribute></b>
[4712]533 </center></td>
534 <td align="right">
535 <xsl:if test=" not($pos = $length)">
[24007]536 <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ns"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
[4712]537 </xsl:if>
538 </td>
539 </tr>
540 </xsl:otherwise>
541 </xsl:choose>
542 <tr valign="middle">
[4877]543 <td align='center' valign='top' colspan='3'>
[5381]544 <form name="GotoForm" method="get" action="{$library_name}">
[4877]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"/>
[24007]549 <input type="submit" class="getTextFor null this.value.doc.gotopage"></input>
[4877]550 </form>
[4712]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"/>
[6373]559 <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
[4712]560 <xsl:for-each select="../serviceList/service">
561 <table border='1' cellspacing='0'>
562 <tr><td>
[4900]563 <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
[5381]564 <form name="EnrichForm" method="get" action="{$library_name}">
[4712]565 <xsl:apply-templates select="paramList"/>
[24007]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'/>
[4900]576 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
[4712]577 </form>
578 </td></tr>
579 </table>
[4047]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>
[4712]586 </xsl:text>
[4047]587 </xsl:for-each>
588 </xsl:template>
[4712]589
[11281]590 <xsl:template name="documentArrows">
591 <xsl:param name="collName"/>
[14540]592 <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
593
[13267]594 <div class="documentarrows">
[18316]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>
[13267]605 </div>
606
[11281]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"/>
[24007]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;amp;c=<xsl:value-of select="$collName"/>&amp;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;amp;sib=1&amp;amp;p.s=<xsl:value-of select="$request-params/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$request-params/param[@name='p.sa']/@value"/>&amp;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>
[13580]615 </xsl:if>
[11281]616 </xsl:template>
[14535]617
618 <xsl:template name="externalPage">
[18316]619 <xsl:param name="external"/>
[24007]620 <xsl:variable name="go_forward_link"><a class="getTextfor external.go_forward"><xsl:attribute name="href"><xsl:value-of select="$external"/></xsl:attribute></a></xsl:variable>
621 <h2 class="getTextFor external.title"></h2>
622 <p><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.external.text|', $go_forward_link)" /></xsl:attribute>
[14535]623 </p>
624 </xsl:template>
625
[4047]626</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.