source: main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl@ 26298

Last change on this file since 26298 was 26298, checked in by sjm84, 8 years ago

The documentContent template will no longer affect non-simple documents

File size: 26.5 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:gslib="http://www.greenstone.org/skinning"
7 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
8 extension-element-prefixes="java util"
9 exclude-result-prefixes="java util gsf">
10
11 <!-- use the 'main' layout -->
12 <xsl:import href="layouts/main.xsl"/>
13 <xsl:import href="layouts/toc.xsl"/>
14
15 <xsl:variable name="bookswitch">
16 <xsl:choose>
17 <xsl:when test="/page/pageRequest/paramList/param[@name='book']/@value">
18 <xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/>
19 </xsl:when>
20 <xsl:otherwise>off</xsl:otherwise>
21 </xsl:choose>
22 </xsl:variable>
23
24 <!-- set page title -->
25 <xsl:template name="pageTitle"><gslib:documentTitle/></xsl:template>
26
27 <!-- set page breadcrumbs -->
28 <xsl:template name="breadcrumbs">
29 <gslib:siteLink/><gslib:rightArrow/>
30 <gslib:collectionNameLinked/><gslib:rightArrow/>
31 <a>
32 <xsl:attribute name="href">
33 <xsl:value-of select="$library_name"/>/collection/<xsl:value-of select="$collName"/>/document/<xsl:value-of select="/page/pageResponse/document/documentNode[1]/@nodeID"/>
34 </xsl:attribute>
35 <xsl:variable name="documentTitleVar">
36 <gslib:documentTitle/>
37 </xsl:variable>
38 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
39 </a>
40 </xsl:template>
41
42 <xsl:template match="/">
43 <xsl:choose>
44 <!-- if this is the realistic books version of the page -->
45 <xsl:when test="$bookswitch = 'flashxml'">
46 <html>
47 <body>
48 <xsl:apply-templates select="/page/pageResponse/document"/>
49 </body>
50 </html>
51 </xsl:when>
52 <!-- if this is the regular version of the page -->
53 <xsl:otherwise>
54 <xsl:call-template name="mainTemplate"/>
55 </xsl:otherwise>
56 </xsl:choose>
57 </xsl:template>
58
59 <xsl:template name="documentHeading">
60 <b><gsf:metadata name="Title"/></b><br/>
61 </xsl:template>
62
63 <xsl:template name="documentContent">
64 <div id="gs-document">
65 <xsl:call-template name="documentPre"/>
66 <xsl:call-template name="wrappedSectionImage"/>
67 <div id="gs-document-text">
68 <xsl:call-template name="documentNodeText"/>
69 </div>
70 </div>
71 </xsl:template>
72
73 <xsl:template name="sectionHeading">
74 <xsl:call-template name="sectionTitle"/>
75 </xsl:template>
76
77 <xsl:template name="topLevelSectionContent">
78 <xsl:call-template name="wrappedSectionImage"/>
79 <xsl:call-template name="wrappedSectionText"/>
80 </xsl:template>
81
82 <xsl:template name="sectionContent">
83 <xsl:call-template name="wrappedSectionImage"/>
84 <xsl:call-template name="wrappedSectionText"/>
85 </xsl:template>
86
87 <xsl:template name="wrappedSectionText">
88 <div id="text{@nodeID}" class="sectionText"><!-- *** -->
89 <xsl:attribute name="style">
90 <xsl:choose>
91 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'image'">
92 <xsl:text>display:none;</xsl:text>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:text>display:block;</xsl:text>
96 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:attribute>
99
100 <xsl:call-template name="documentNodeText"/>
101 </div>
102 </xsl:template>
103
104 <xsl:template name="sectionImage">
105 <gsf:image type="screen"/>
106 </xsl:template>
107
108 <!-- Used to make sure that regardless what the collection designer uses for the title and content we can wrap it properly -->
109 <!-- If editing, be aware that the Document Basket looks for specific classes that this template bakes in (key points marked with ***) -->
110 <xsl:template name="wrapDocumentNodes">
111 <a name="{@nodeID}"><xsl:text> </xsl:text></a>
112
113 <!-- Section header -->
114 <table class="sectionHeader"><tr>
115
116 <!-- Expand/collapse button -->
117 <xsl:if test="not(/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value) or /page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='sectionExpandCollapse']/@value = 'true'">
118 <td class="headerTD">
119 <img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
120 <xsl:attribute name="src">
121 <xsl:choose>
122 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent(@nodeID, /page/pageResponse/document/@selectedNode)">
123 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
124 </xsl:when>
125 <xsl:otherwise>
126 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
127 </xsl:otherwise>
128 </xsl:choose>
129 </xsl:attribute>
130 </img>
131 </td>
132 </xsl:if>
133
134 <!-- Title -->
135 <td id="header{@nodeID}" class="headerTD sectionTitle"><!-- *** -->
136 <p>
137 <xsl:attribute name="class"><xsl:value-of select="util:hashToDepthClass(@nodeID)"/> sectionHeader</xsl:attribute>
138
139 <xsl:if test="util:hashToSectionId(@nodeID)">
140 <span class="sectionNumberSpan">
141 <xsl:value-of select="util:hashToSectionId(@nodeID)"/>
142 <xsl:text> </xsl:text>
143 </span>
144 </xsl:if>
145 <!-- Display the title for the section regardless of whether automatic section numbering is turned on -->
146 <span><xsl:call-template name="sectionHeading"/></span>
147 </p>
148 </td>
149
150 <!-- "back to top" link -->
151 <xsl:if test="util:hashToDepthClass(@nodeID) != 'sectionHeaderDepthTitle' and not(/page/pageResponse/format[@type='display']/gsf:option[@name='backToTopLinks']) or /page/pageResponse/format[@type='display']/gsf:option[@name='backToTopLinks']/@value='true'">
152 <td class="backToTop headerTD">
153 <a href="javascript:scrollToTop();">
154 <xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
155 </a>
156 </td>
157 </xsl:if>
158 </tr></table>
159
160 <div id="doc{@nodeID}"><!-- *** -->
161 <xsl:choose>
162 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or /page/pageResponse/document/@selectedNode = @nodeID">
163 <xsl:attribute name="class">
164 <xsl:text>sectionContainer hasText</xsl:text>
165 </xsl:attribute>
166 <xsl:attribute name="style">
167 <xsl:text>display:block;</xsl:text>
168 </xsl:attribute>
169 </xsl:when>
170 <xsl:when test="/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or util:oidIsMatchOrParent(@nodeID, /page/pageResponse/document/@selectedNode)">
171 <xsl:attribute name="class">
172 <xsl:text>sectionContainer noText</xsl:text>
173 </xsl:attribute>
174 <xsl:attribute name="style">
175 <xsl:text>display:block;</xsl:text>
176 </xsl:attribute>
177 </xsl:when>
178 <xsl:otherwise>
179 <xsl:attribute name="class">
180 <xsl:text>sectionContainer noText</xsl:text>
181 </xsl:attribute>
182 <xsl:attribute name="style">
183 <xsl:text>display:none;</xsl:text>
184 </xsl:attribute>
185 </xsl:otherwise>
186 </xsl:choose>
187
188 <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
189 <table id="meta{@nodeID}">
190 <xsl:attribute name="style">
191 <xsl:choose>
192 <xsl:when test="/page/pageRequest/paramList/param[@name = 'dmd']/@value = 'true'">
193 <xsl:text>display:block;</xsl:text>
194 </xsl:when>
195 <xsl:otherwise>
196 <xsl:text>display:none;</xsl:text>
197 </xsl:otherwise>
198 </xsl:choose>
199 </xsl:attribute>
200 <xsl:value-of select="util:clearMetadataStorage()"/>
201 <xsl:for-each select="metadataList/metadata">
202 <xsl:sort select="@name"/>
203 <xsl:if test="util:checkMetadataNotDuplicate(@name, .)">
204 <tr>
205 <td class="metaTableCellName"><xsl:value-of select="@name"/></td>
206 <td class="metaTableCell"><xsl:value-of disable-output-escaping="yes" select="."/></td>
207 </tr>
208 </xsl:if>
209 </xsl:for-each>
210 </table>
211 </xsl:if>
212
213 <xsl:choose>
214 <xsl:when test="../../document">
215 <xsl:call-template name="topLevelSectionContent"/>
216 </xsl:when>
217 <xsl:otherwise>
218 <xsl:call-template name="sectionContent"/>
219 </xsl:otherwise>
220 </xsl:choose>
221
222 <xsl:if test="documentNode">
223 <xsl:for-each select="documentNode">
224 <xsl:call-template name="wrapDocumentNodes"/>
225 </xsl:for-each>
226 </xsl:if>
227 </div>
228 </xsl:template>
229
230 <!-- the page content -->
231 <xsl:template match="/page/pageResponse/document">
232 <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
233 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts.js"><xsl:text> </xsl:text></script>
234 <script type="text/javascript" src="interfaces/{$interface_name}/js/documentmaker_scripts_util.js"><xsl:text> </xsl:text></script>
235 <script type="text/javascript">
236 <xsl:text disable-output-escaping="yes">
237 $(window).load(function()
238 {
239 if(gs.cgiParams.docEdit == "1")
240 {
241 readyPageForEditing();
242 }
243 });
244 </xsl:text>
245 </script>
246 <gsf:metadata name="all"/>
247 </xsl:if>
248
249 <xsl:if test="$bookswitch = 'off'">
250 <div id="bookdiv" style="visibility:hidden; height:0px; display:inline;"><xsl:text> </xsl:text></div>
251
252 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script>
253
254 <xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
255 <script type="text/javascript">
256 <xsl:text disable-output-escaping="yes">
257 if(document.URL.indexOf("book=on") != -1)
258 {
259 loadBook();
260 }
261 </xsl:text>
262 </script>
263 </xsl:if>
264
265 <xsl:if test="/page/pageRequest/userInformation and (util:contains(/page/pageRequest/userInformation/@groups, 'administrator') or util:contains(/page/pageRequest/userInformation/@groups, 'all-collections-editor') or util:contains(/page/pageRequest/userInformation/@groups, $thisCollectionEditor))">
266 <xsl:call-template name="editBar"/>
267 </xsl:if>
268
269 <xsl:if test="not(/page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']) or /page/pageResponse/format[@type='display']/gsf:option[@name='sideBar']/@value='true'">
270 <xsl:call-template name="rightSidebar"/>
271 </xsl:if>
272 </xsl:if>
273
274 <!-- display the document -->
275 <xsl:choose>
276 <xsl:when test="@external != ''">
277 <xsl:call-template name="externalPage">
278 <xsl:with-param name="external" select="@external"/>
279 </xsl:call-template>
280 </xsl:when>
281 <xsl:when test="$bookswitch = 'flashxml'">
282 <xsl:call-template name="documentNodeFlashXML"/>
283 </xsl:when>
284 <xsl:when test="$bookswitch = 'on'">
285 <div id="bookdiv" style="display:inline;"><xsl:text> </xsl:text></div>
286 <!-- *** in document-scripts.js *** -->
287 <script type="text/javascript">
288 <xsl:text disable-output-escaping="yes">
289 if(document.URL.indexOf("book=on") != -1)
290 {
291 loadBook();
292 }
293 </xsl:text>
294 </script>
295 </xsl:when>
296 <xsl:when test="@docType='simple'">
297 <xsl:call-template name="documentHeading"/><br/>
298 <xsl:call-template name="documentContent"/>
299 </xsl:when>
300 <xsl:otherwise> <!-- display the standard greenstone document -->
301 <xsl:call-template name="wrappedDocument"/>
302 </xsl:otherwise>
303 </xsl:choose>
304 </xsl:template>
305
306 <xsl:template name="wrappedDocument">
307 <xsl:choose>
308 <!-- NOTE: alb = ajax load bypass -->
309 <!--
310 If the docType is hierarchy and we want to bypass the ajax load then do this
311 OR If the docType is hierarchy and we have asked for the expanded document OR we have asked for the top level document then do this
312 -->
313 <xsl:when test="/page/pageResponse/document/@docType = 'hierarchy' and (/page/pageRequest/paramList/param[@name = 'alb']/@value = '1' or (string-length(/page/pageRequest/paramList/param[@name = 'd']/@value) > 0 and (/page/pageRequest/paramList/param[@name = 'ed']/@value = '1' or not(util:contains(/page/pageResponse/document/@selectedNode, '.')))))">
314 <div id="gs-document">
315 <xsl:call-template name="documentPre"/>
316 <div id="gs-document-text" class="documenttext" collection="{/page/pageResponse/collection/@name}"><!-- *** -->
317 <xsl:for-each select="documentNode">
318 <xsl:call-template name="wrapDocumentNodes"/>
319 </xsl:for-each>
320 </div>
321 </div>
322 </xsl:when>
323 <xsl:when test="/page/pageResponse/document/@docType = 'paged' or /page/pageResponse/document/@docType = 'pagedhierarchy'">
324 <div id="gs-document">
325 <div id="tocLoadingImage" style="text-align:center;">
326 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
327 </div>
328 </div>
329 <script type="text/javascript">
330 <xsl:text disable-output-escaping="yes">
331 $(window).load(function()
332 {
333 var sectionID = gs.cgiParams.d;
334 var callbackFunction = null;
335 if(sectionID.indexOf("\\.") == -1)
336 {
337 callbackFunction = function()
338 {
339 focusSection(sectionID);
340 };
341 }
342
343 var docID = sectionID.replace(/([^.]*)\..*/, "$1");
344 var url = gs.xsltParams.library_name + "?a=d&amp;c=" + gs.cgiParams.c + "&amp;excerptid=gs-document&amp;dt=hierarchy&amp;d=" + docID;
345 loadTopLevelPage(callbackFunction, url);
346 });
347 </xsl:text>
348 </script>
349 </xsl:when>
350 <xsl:otherwise>
351 <div id="gs-document">
352 <div id="tocLoadingImage" style="text-align:center;">
353 <img src="{util:getInterfaceText($interface_name, /page/@lang, 'loading_image')}"/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.loading')"/><xsl:text>...</xsl:text>
354 </div>
355 </div>
356 <script type="text/javascript">
357 <xsl:text disable-output-escaping="yes">
358 $(window).load(function()
359 {
360 loadTopLevelPage(function()
361 {
362 //Don't focus the section until the table of contents is loaded
363 var tocCheck = function()
364 {
365 if(gs.variables.tocLoaded)
366 {
367 focusSection("</xsl:text><xsl:value-of select="/page/pageResponse/document/@selectedNode"/><xsl:text disable-output-escaping="yes">");
368 }
369 else
370 {
371 setTimeout(tocCheck, 500);
372 }
373 }
374 tocCheck();
375 });
376 });
377 </xsl:text>
378 </script>
379 </xsl:otherwise>
380 </xsl:choose>
381
382 <div class="clear"><xsl:text> </xsl:text></div>
383 </xsl:template>
384
385 <xsl:template name="editBar">
386 <table style="width:100%"><tr>
387 <td id="editBarLeft" style="width:70%"><xsl:text> </xsl:text></td>
388 <td id="editBarRight">
389 <div style="text-align:center;">
390 <div style="margin:5px;" class="ui-state-default ui-corner-all">
391 <a style="padding: 3px; text-decoration:none;" href="{$library_name}?a=g&amp;sa=documentbasket&amp;c=&amp;s=DisplayDocumentList&amp;rt=r&amp;p.c={/page/pageResponse/collection/@name}&amp;docToEdit={/page/pageResponse/document/documentNode/@nodeID}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.edit_structure')"/></a>
392 </div>
393 <div style="margin:5px;" class="ui-state-default ui-corner-all">
394 <a id="editContentButton" style="padding: 3px; text-decoration:none;">
395 <xsl:attribute name="href">
396 <xsl:value-of select="$library_name"/>
397 <xsl:text>/collection/</xsl:text>
398 <xsl:value-of select="$collName"/>
399 <xsl:text>/document/</xsl:text>
400 <xsl:choose>
401 <xsl:when test="count(//documentNode) > 0">
402 <xsl:value-of select="/page/pageResponse/document/documentNode/@nodeID"/>
403 </xsl:when>
404 <xsl:otherwise>
405 <xsl:value-of select="/page/pageResponse/document/@nodeID"/>
406 </xsl:otherwise>
407 </xsl:choose>
408 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1')">
409 <xsl:text>?ed=1&amp;docEdit=1&amp;dt=hierarchy</xsl:text>
410 </xsl:if>
411 </xsl:attribute>
412 <xsl:choose>
413 <xsl:when test="/page/pageRequest/paramList/param[@name = 'docEdit']/@value = '1'">
414 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.hide_editor')"/>
415 </xsl:when>
416 <xsl:otherwise>
417 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.edit_content')"/>
418 </xsl:otherwise>
419 </xsl:choose>
420 </a>
421 </div>
422 </div>
423 </td>
424 </tr></table>
425 <gslib:langfrag name="dse"/>
426 </xsl:template>
427
428 <!-- Highlight annotations if requested -->
429 <xsl:template name="displayAnnotation">
430 <xsl:choose>
431 <xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
432 <span class="termHighlight"><xsl:value-of select="."/></span>
433 </xsl:when>
434 <xsl:otherwise>
435 <span class="noTermHighlight"><xsl:value-of select="."/></span>
436 </xsl:otherwise>
437 </xsl:choose>
438 </xsl:template>
439
440 <!-- The default template for displaying section titles -->
441 <xsl:template name="sectionTitle">
442 <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/>
443 </xsl:template>
444
445 <xsl:template name="wrappedSectionImage">
446 <gsf:variable name="screenImageWidth"><gsf:metadata name="ScreenWidth"/></gsf:variable>
447 <gsf:variable name="screenImageHeight"><gsf:metadata name="ScreenHeight"/></gsf:variable>
448 <gsf:variable name="imageWidth"><gsf:metadata name="ImageWidth"/></gsf:variable>
449 <gsf:variable name="imageHeight"><gsf:metadata name="ImageHeight"/></gsf:variable>
450
451 <xsl:choose>
452 <xsl:when test="metadataList/metadata[@name = 'Screen'] and metadataList/metadata[@name = 'SourceFile'] and ($imageWidth div $screenImageWidth > 1.2)">
453 <div id="image{@nodeID}">
454 <div id="wrap{util:replace(@nodeID, '.', '_')}" class="zoomImage" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
455 <div id="small{util:replace(@nodeID, '.', '_')}" style="position:relative; width: {$screenImageWidth}px; height: {$screenImageHeight}px;">
456 <gsf:image type="screen"/>
457 </div>
458 <div id="mover{util:replace(@nodeID, '.', '_')}" style="border: 1px solid green; position: absolute; top: 0; left: 0; width: 398px; height: 398px; overflow: hidden; z-index: 100; background: white; display: none;">
459 <div id="overlay{util:replace(@nodeID, '.', '_')}" style="width: 400px; height: 400px; position: absolute; top: 0; left: 0; z-index: 200;">
460 <xsl:text> </xsl:text>
461 </div>
462 <div id="large{util:replace(@nodeID, '.', '_')}" style="position: relative; width: {$imageWidth}px; height: {$imageHeight}px;">
463 <gsf:image type="source"/>
464 </div>
465 </div>
466 </div>
467 <script type="text/javascript">
468 <xsl:text disable-output-escaping="yes">
469 {
470 var nodeID = "</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">";
471 nodeID = nodeID.replace(/\./g, "_");
472
473 var bigHeight = </xsl:text><xsl:value-of select="$imageHeight"/><xsl:text disable-output-escaping="yes">;
474 var smallHeight = </xsl:text><xsl:value-of select="$screenImageHeight"/><xsl:text disable-output-escaping="yes">;
475
476 var multiplier = bigHeight / smallHeight;
477
478 $("#wrap" + nodeID).anythingZoomer({
479 smallArea: "#small" + nodeID,
480 largeArea: "#large" + nodeID,
481 zoomPort: "#overlay" + nodeID,
482 mover: "#mover" + nodeID,
483 expansionSize:50,
484 speedMultiplier:multiplier
485 });
486
487 $("#zoomOptions input").attr("checked", false);
488 $("#zoomOptions").css("display", null);
489 }
490 </xsl:text>
491 </script>
492 </div>
493 </xsl:when>
494 <xsl:otherwise>
495 <div id="image{@nodeID}">
496 <xsl:attribute name="style">
497 <xsl:choose>
498 <xsl:when test="/page/pageRequest/paramList/param[@name = 'view']/@value = 'text'">
499 <xsl:text>display:none;</xsl:text>
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:text>display:block;</xsl:text>
503 </xsl:otherwise>
504 </xsl:choose>
505 </xsl:attribute>
506 <xsl:call-template name="sectionImage"/><xsl:text> </xsl:text>
507 </div>
508 </xsl:otherwise>
509 </xsl:choose>
510 </xsl:template>
511
512 <!-- The default template for displaying the document node text -->
513 <!-- equivalent to gsf:text -->
514 <xsl:template name="documentNodeText">
515 <!-- Hides the "This document has no text." message -->
516 <xsl:variable name="noText"><gsf:metadata name="NoText"/></xsl:variable>
517 <xsl:if test="not($noText = '1')">
518 <!-- Section text -->
519 <xsl:for-each select="nodeContent">
520 <xsl:for-each select="node()">
521 <xsl:choose>
522 <xsl:when test="not(name())">
523 <xsl:value-of select="." disable-output-escaping="yes"/>
524 </xsl:when>
525 <xsl:when test="name() = 'annotation'">
526 <xsl:call-template name="displayAnnotation"/>
527 </xsl:when>
528 <xsl:otherwise>
529 <xsl:apply-templates/>
530 </xsl:otherwise>
531 </xsl:choose>
532 </xsl:for-each>
533 </xsl:for-each>
534 </xsl:if><xsl:text> </xsl:text>
535 </xsl:template>
536
537 <!-- Used to produce a version of the page in a format that can be read by the realistic books plugin -->
538 <xsl:template name="documentNodeFlashXML">
539 <xsl:text disable-output-escaping="yes">
540 &lt;Section&gt;
541 &lt;Description&gt;
542 &lt;Metadata name="Title"&gt;
543 </xsl:text>
544 <xsl:value-of select="normalize-space(metadataList/metadata[@name = 'Title'])"/>
545 <xsl:text disable-output-escaping="yes">
546 &lt;/Metadata&gt;
547 &lt;/Description&gt;
548 </xsl:text>
549
550 <xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
551
552 <xsl:for-each select="documentNode">
553 <xsl:call-template name="documentNodeFlashXML"/>
554 </xsl:for-each>
555
556 <xsl:text disable-output-escaping="yes">
557 &lt;/Section&gt;
558 </xsl:text>
559 </xsl:template>
560
561 <xsl:template name="externalPage">
562 <xsl:param name="external"/>
563 <xsl:variable name="go_forward_link">
564 <a>
565 <xsl:attribute name="href">
566 <xsl:value-of select="$external"/>
567 </xsl:attribute>
568 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.go_forward')"/>
569 </a>
570 </xsl:variable>
571 <h2><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'external.title')"/></h2>
572 <p><xsl:value-of select="util:getInterfaceTextWithDOM($interface_name, /page/@lang, 'external.text', $go_forward_link)" disable-output-escaping="yes"/></p>
573 </xsl:template>
574
575 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/document"/></xsl:template> <!-- this to be deleted eventually -->
576
577 <xsl:template name="documentPre">
578 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
579 <xsl:call-template name="mapFeatures"/>
580 </xsl:if>
581 </xsl:template>
582
583 <xsl:template name="mapFeatures">
584 <div id="map_canvas" class="map_canvas_full"><xsl:text> </xsl:text></div>
585
586 <xsl:choose>
587 <!-- HIERARCHICAL DOCUMENTS -->
588 <xsl:when test="count(//documentNode) > 0">
589 <xsl:for-each select="documentNode">
590 <xsl:call-template name="mapPlacesNearHere"/>
591 </xsl:for-each>
592 </xsl:when>
593 <!-- SIMPLE DOCUMENTS -->
594 <xsl:otherwise>
595 <xsl:call-template name="mapPlacesNearHere"/>
596 </xsl:otherwise>
597 </xsl:choose>
598
599 <div id="jsonNodes" style="display:none;">
600 <xsl:text>[</xsl:text>
601 <xsl:choose>
602 <!-- HIERARCHICAL DOCUMENTS -->
603 <xsl:when test="count(//documentNode) > 0">
604 <xsl:for-each select="//documentNode">
605 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
606 <xsl:text>{</xsl:text>
607 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
608 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/><xsl:text disable-output-escaping="yes">",</xsl:text>
609 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
610 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
611 <xsl:text>}</xsl:text>
612 <xsl:if test="not(position() = count(//documentNode))">
613 <xsl:text>,</xsl:text>
614 </xsl:if>
615 </xsl:if>
616 </xsl:for-each>
617 </xsl:when>
618 <!-- SIMPLE DOCUMENTS -->
619 <xsl:otherwise>
620 <xsl:for-each select="/page/pageResponse/document">
621 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
622 <xsl:text>{</xsl:text>
623 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@selectedNode"/><xsl:text disable-output-escaping="yes">",</xsl:text>
624 <xsl:text disable-output-escaping="yes">"title":"</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Title']"/><xsl:text disable-output-escaping="yes">",</xsl:text>
625 <xsl:text disable-output-escaping="yes">"lat":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Latitude']"/><xsl:text>,</xsl:text>
626 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
627 <xsl:text>}</xsl:text>
628 </xsl:if>
629 </xsl:for-each>
630 </xsl:otherwise>
631 </xsl:choose>
632 <xsl:text>]</xsl:text>
633 </div>
634 </xsl:template>
635
636 <xsl:template name="mapPlacesNearHere">
637 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
638 <div style="background:#BBFFBB; padding: 5px; margin:0px auto; width:890px;">
639 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.maps.nearby_docs')"/>
640 <img id="nearbyDocumentsToggle" style="margin-left:5px;" src="interfaces/{$interface_name}/images/expand.png">
641 <xsl:attribute name="onclick">
642 <xsl:text>performDistanceSearch('</xsl:text>
643 <xsl:value-of select="@nodeID"/>
644 <xsl:text>', '</xsl:text>
645 <gsf:metadata name="Latitude"/>
646 <xsl:text>', '</xsl:text>
647 <gsf:metadata name="Longitude"/>
648 <xsl:text>', 2);</xsl:text>
649 </xsl:attribute>
650 </img>
651 <div id="nearbyDocuments"><xsl:text> </xsl:text></div>
652 </div>
653 </xsl:if>
654 </xsl:template>
655</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.