source: main/trunk/greenstone3/web/interfaces/default/transform/pages/query.xsl@ 25736

Last change on this file since 25736 was 25736, checked in by sjm84, 12 years ago

Hopefully fixed searching, also the search form remains on the page after the search

File size: 21.9 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
14 <!-- set page title -->
15 <xsl:template name="pageTitle"><gslib:serviceName/></xsl:template>
16
17 <!-- set page breadcrumbs -->
18 <xsl:template name="breadcrumbs"> <gslib:siteLink/><gslib:rightArrow/><xsl:if test="/page/pageResponse/collection"> <gslib:collectionNameLinked/><gslib:rightArrow/></xsl:if></xsl:template>
19
20 <!-- the page content -->
21 <xsl:template match="/page">
22 <xsl:call-template name="queryPage"/>
23 <xsl:call-template name="resultsPage"/>
24 </xsl:template>
25
26 <xsl:template name="resultsPage">
27 <xsl:call-template name="resultsPagePre"/>
28 <xsl:call-template name="displayTermInfo"/>
29 <xsl:call-template name="displayResults"/>
30 <xsl:call-template name="resultsPagePost"/>
31 </xsl:template>
32
33 <xsl:template name="displayResults">
34 <table id="results">
35 <xsl:for-each select="pageResponse/documentNodeList/documentNode">
36 <tr class="document">
37 <xsl:apply-templates select="."/>
38 <xsl:call-template name="documentNodePost"/>
39 </tr>
40 </xsl:for-each>
41 <br/>
42 </table>
43
44 <!-- Previous/Next buttons-->
45 <xsl:call-template name="prevNextButtons"/>
46 </xsl:template>
47
48 <xsl:template name="displayTermInfo">
49
50 <!-- Find the number of documents displayed per page -->
51 <xsl:variable name="level">
52 <xsl:choose>
53 <xsl:when test="/page/pageRequest/paramList/param[@name='level']">
54 <xsl:value-of select="/page/pageRequest/paramList/param[@name='level']/@value" />
55 </xsl:when>
56 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.level']">
57 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.level']/@value" />
58 </xsl:when>
59 <xsl:otherwise>Doc</xsl:otherwise>
60 </xsl:choose>
61 </xsl:variable>
62
63 <!-- The list of search terms with their frequency and document count -->
64 <p class="termList">
65 <xsl:if test="count(/page/pageResponse/termList/stopword) &gt; 0">
66 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/><xsl:text> </xsl:text>
67 </xsl:if>
68
69 <xsl:for-each select="/page/pageResponse/termList/stopword">
70 <span style="font-style:italic;"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
71 </xsl:for-each>
72 <br /><br />
73
74 <xsl:for-each select="/page/pageResponse/termList/term">
75 <xsl:choose>
76 <!-- If there is only one or two search terms then show the expanded information -->
77 <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
78 <span style="font-style:italic;"><xsl:value-of select="@name"/></span>
79 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.occurs')"/><xsl:text> </xsl:text>
80 <xsl:value-of select="@freq"/>
81 <xsl:choose>
82 <xsl:when test="@freq = 1">
83 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time')"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time_plural')"/>
87 </xsl:otherwise>
88 </xsl:choose>
89 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.in')"/><xsl:text> </xsl:text>
90 <xsl:value-of select="@numDocsMatch"/>
91 <xsl:choose>
92 <xsl:when test="@numDocsMatch = 1">
93 <xsl:text> </xsl:text>
94 <xsl:choose>
95 <xsl:when test="$level = 'Doc'">
96 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
97 </xsl:when>
98 <xsl:otherwise>
99 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section')"/>
100 </xsl:otherwise>
101 </xsl:choose>
102 </xsl:when>
103 <xsl:otherwise>
104 <xsl:text> </xsl:text>
105 <xsl:choose>
106 <xsl:when test="$level = 'Doc'">
107 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
108 </xsl:when>
109 <xsl:otherwise>
110 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
111 </xsl:otherwise>
112 </xsl:choose>
113 </xsl:otherwise>
114 </xsl:choose>
115 <br />
116 </xsl:when>
117 <xsl:otherwise>
118 <span style="font-style:italic;"><xsl:value-of select="@name"/></span> (<xsl:value-of select="@freq"/>)
119 </xsl:otherwise>
120 </xsl:choose>
121 </xsl:for-each>
122 </p>
123 </xsl:template>
124
125 <xsl:template name="queryPage">
126 <xsl:for-each select="pageResponse/service">
127 <form name="QueryForm" method="get" action="{$library_name}/collection/{$collName}/search/{@name}">
128 <div>
129 <input type="hidden" name="a" value="q"/>
130 <input type="hidden" name="sa"><xsl:attribute name="value"><xsl:value-of select="/page/pageRequest/@subaction"/></xsl:attribute></input>
131 <input type="hidden" name="rt" value="rd"/>
132 <xsl:choose>
133 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.maxDocs']">
134 <input type="hidden" name="s1.maxDocs">
135 <xsl:attribute name="value">
136 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.maxDocs']/@value"/>
137 </xsl:attribute>
138 </input>
139 </xsl:when>
140 <xsl:otherwise>
141 <input type="hidden" name="s1.maxDocs" value="100"/>
142 </xsl:otherwise>
143 </xsl:choose>
144 <xsl:choose>
145 <xsl:when test="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']">
146 <input type="hidden" name="s1.hitsPerPage">
147 <xsl:attribute name="value">
148 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']/@value"/>
149 </xsl:attribute>
150 </input>
151 </xsl:when>
152 <xsl:otherwise>
153 <input type="hidden" name="s1.hitsPerPage" value="20"/>
154 </xsl:otherwise>
155 </xsl:choose>
156
157 <xsl:variable name="ns">s1.</xsl:variable>
158 <xsl:for-each select="paramList/param">
159 <xsl:choose>
160 <xsl:when test="@name='case' or @name='stem' or @name='accent'">
161 </xsl:when>
162 <xsl:when test="@type='multi'">
163 <xsl:apply-templates select="."><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>
164 </xsl:when>
165 <xsl:when test="@name = 'maxDocs' or @name = 'hitsPerPage'"></xsl:when>
166 <xsl:otherwise>
167 <xsl:variable name="pvalue"><xsl:apply-templates select="." mode="calculate-default"><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates></xsl:variable>
168 <div class="paramLabel"><xsl:value-of select="displayItem[@name='name']"/></div>
169 <div class="paramValue">
170 <xsl:apply-templates select=".">
171 <xsl:with-param name="default" select="$pvalue"/>
172 <xsl:with-param name="ns" select="$ns"/>
173 </xsl:apply-templates>
174 </div>
175 <br class="clear"/>
176 </xsl:otherwise>
177 </xsl:choose>
178 </xsl:for-each>
179 <br/>
180 <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
181 </div>
182 </form>
183 </xsl:for-each>
184 </xsl:template>
185
186 <xsl:template name="prevNextButtons">
187 <!-- Current page -->
188 <xsl:variable name="currentPage">
189 <xsl:choose>
190 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.startPage']/@value">
191 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.startPage']/@value" />
192 </xsl:when>
193 <xsl:when test="/page/pageRequest/paramList/param[@name='startPage']/@value">
194 <xsl:value-of select="/page/pageRequest/paramList/param[@name='startPage']/@value" />
195 </xsl:when>
196 <xsl:otherwise>1</xsl:otherwise>
197 </xsl:choose>
198 </xsl:variable>
199
200 <xsl:variable name="usesS1">
201 <xsl:choose>
202 <xsl:when test="/page/pageResponse/service/paramList/param[@name='startPage']">true</xsl:when>
203 <xsl:otherwise>false</xsl:otherwise>
204 </xsl:choose>
205 </xsl:variable>
206
207 <!-- Find the total number of documents returned -->
208 <xsl:variable name="docMax">
209 <xsl:choose>
210 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
211 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
212 </xsl:when>
213 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']">
214 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']"/>
215 </xsl:when>
216 <xsl:otherwise><xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/></xsl:otherwise>
217 </xsl:choose>
218 </xsl:variable>
219
220 <!-- Find the number of documents displayed per page -->
221 <xsl:variable name="docsPerPage">
222 <xsl:choose>
223 <xsl:when test="/page/pageRequest/paramList/param[@name='hitsPerPage']">
224 <xsl:value-of select="/page/pageRequest/paramList/param[@name='hitsPerPage']/@value" />
225 </xsl:when>
226 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']">
227 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']/@value" />
228 </xsl:when>
229 <xsl:otherwise>20</xsl:otherwise>
230 </xsl:choose>
231 </xsl:variable>
232
233 <!-- Find the number of documents displayed per page -->
234 <xsl:variable name="level">
235 <xsl:choose>
236 <xsl:when test="/page/pageRequest/paramList/param[@name='level']">
237 <xsl:value-of select="/page/pageRequest/paramList/param[@name='level']/@value" />
238 </xsl:when>
239 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.level']">
240 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.level']/@value" />
241 </xsl:when>
242 <xsl:otherwise>Doc</xsl:otherwise>
243 </xsl:choose>
244 </xsl:variable>
245
246 <table id="searchResultNavTable"><tr>
247 <xsl:variable name="startPageName"><xsl:if test="$usesS1 = 'true'">s1.</xsl:if>startPage</xsl:variable>
248
249 <!-- Previous button -->
250 <td id="prevArrowTD">
251 <xsl:if test="$currentPage != 1">
252 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage - 1}">
253 <img src="interfaces/default/images/previous.png"/>
254 </a>
255 </xsl:if>
256 </td>
257 <td id="prevTD">
258 <xsl:if test="$currentPage != 1">
259 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage - 1}">Previous</a>
260 </xsl:if>
261 </td>
262
263 <!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
264 <xsl:if test="$docMax &gt; 0">
265 <td id="searchResultsStatusBar">
266 <!-- "Displaying" -->
267 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displaying')"/><xsl:text> </xsl:text>
268 <!-- "X" -->
269 <xsl:value-of select="($currentPage - 1) * $docsPerPage + 1"/>
270 <!-- "to" -->
271 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.to')"/><xsl:text> </xsl:text>
272 <!-- "Y" -->
273 <xsl:choose>
274 <xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
275 <xsl:value-of select="$docMax"/>
276 </xsl:when>
277 <xsl:otherwise>
278 <xsl:value-of select="$currentPage * $docsPerPage"/>
279 </xsl:otherwise>
280 </xsl:choose>
281 <!-- "of" -->
282 <xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.of')"/><xsl:text> </xsl:text>
283 <!-- "Z" -->
284 <xsl:value-of select="$docMax"/>
285 <!-- "document[s]/section[s]"-->
286 <xsl:choose>
287 <xsl:when test="$docMax = 1">
288 <xsl:text> </xsl:text>
289 <xsl:choose>
290 <xsl:when test="$level = 'Doc'">
291 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
292 </xsl:when>
293 <xsl:otherwise>
294 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section')"/>
295 </xsl:otherwise>
296 </xsl:choose>
297 </xsl:when>
298 <xsl:otherwise>
299 <xsl:text> </xsl:text>
300 <xsl:choose>
301 <xsl:when test="$level = 'Doc'">
302 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
303 </xsl:when>
304 <xsl:otherwise>
305 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
306 </xsl:otherwise>
307 </xsl:choose>
308 </xsl:otherwise>
309 </xsl:choose>
310 </td>
311 </xsl:if>
312
313 <!-- Next button -->
314 <td id="nextTD">
315 <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
316 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage + 1}">Next</a>
317 </xsl:if>
318 </td>
319 <td id="nextArrowTD">
320 <xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
321 <a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;{$startPageName}={$currentPage + 1}">
322 <img src="interfaces/default/images/next.png"/>
323 </a>
324 </xsl:if>
325 </td>
326 </tr></table>
327 </xsl:template>
328
329 <!-- puts all the params into a=p&p=h type form - need to change this if use
330 multi params -->
331 <xsl:template match="paramList" mode="cgi">
332 <xsl:param name="ns">s1.</xsl:param>
333 <xsl:for-each select="param">
334 <xsl:variable name='pname' select="@name"/>
335 <xsl:text>&amp;</xsl:text><xsl:value-of select="$ns"/><xsl:value-of select="@name"/>=<xsl:apply-templates select="." mode="calculate-default"><xsl:with-param name='ns' select='$ns'/></xsl:apply-templates>
336 </xsl:for-each>
337 </xsl:template>
338
339 <xsl:template match="param" mode="calculate-default">
340 <xsl:param name="ns">s1.</xsl:param>
341 <xsl:variable name="pname"><xsl:value-of select="$ns"/><xsl:value-of select="@name"/></xsl:variable>
342 <xsl:choose>
343 <xsl:when test="/page/pageRequest/paramList/param[@name=$pname]">
344 <xsl:choose>
345 <xsl:when test="@type='enum_multi'"><xsl:text>,</xsl:text>
346 <xsl:for-each select="/page/pageRequest/paramList/param[@name=$pname]">
347 <xsl:value-of select="@value"/>,
348 </xsl:for-each>
349 </xsl:when>
350 <xsl:otherwise>
351 <xsl:value-of select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
352 </xsl:otherwise>
353 </xsl:choose>
354 </xsl:when>
355 <xsl:otherwise>
356 <xsl:value-of select="@default"/>
357 </xsl:otherwise>
358 </xsl:choose>
359 </xsl:template>
360
361 <!-- invisible params - used by other stuff. in the query form, we set to the default -->
362 <xsl:template match="param[@type='invisible']">
363 <xsl:param name="ns">s1.</xsl:param>
364 <input type='hidden' name='{$ns}{@name}' value='{@default}'/>
365 </xsl:template>
366
367 <!-- boolean params -->
368 <xsl:template match="param[@type='boolean']">
369 <xsl:param name="ns">s1.</xsl:param>
370 <xsl:param name="default"/>
371 <select name='{$ns}{@name}'>
372 <option value="0"><xsl:if test="$default='0'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="option[@name='0']/displayItem[@name='name']"/></option>
373 <option value="1"><xsl:if test="$default='1'"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="option[@name='1']/displayItem[@name='name']"/></option>
374 </select>
375 </xsl:template>
376
377 <!-- integer params -->
378 <xsl:template match="param[@type='integer']">
379 <xsl:param name="ns">s1.</xsl:param>
380 <xsl:param name="default"/>
381 <input type="text" name="{$ns}{@name}" size="3" value="{$default}"/>
382 </xsl:template>
383
384 <!-- single selection enum params -->
385 <xsl:template match="param[@type='enum_single']">
386 <xsl:param name="ns">s1.</xsl:param>
387 <xsl:param name="default"/>
388 <xsl:choose>
389 <xsl:when test="count(option) = 1">
390 <xsl:value-of select="option/displayItem[@name='name']"/>
391 <input type='hidden' name='{$ns}{@name}'><xsl:attribute name='value'><xsl:value-of select='option/@name'/></xsl:attribute></input>
392 </xsl:when>
393 <xsl:otherwise>
394 <select name="{$ns}{@name}">
395 <xsl:for-each select="option">
396 <option value="{@name}"><xsl:if test="@name=$default"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
397 </xsl:for-each>
398 </select>
399 </xsl:otherwise>
400 </xsl:choose>
401 </xsl:template>
402
403
404 <!-- multiple selection enum params -->
405 <!-- how to do defaults for this?? -->
406 <xsl:template match="param[@type='enum_multi']">
407 <xsl:param name="ns">s1.</xsl:param>
408 <xsl:param name="default"/>
409 <select name="{$ns}{@name}" size="2">
410 <xsl:attribute name="multiple"></xsl:attribute>
411 <xsl:for-each select="option">
412 <option value="{@name}"><xsl:if test="contains($default, concat(',', @name, ','))"><xsl:attribute name="selected"></xsl:attribute></xsl:if><xsl:value-of select="displayItem[@name='name']"/></option>
413 </xsl:for-each>
414 </select>
415 </xsl:template>
416
417 <!-- string params -->
418 <xsl:template match="param[@type='string']">
419 <xsl:param name="ns">s1.</xsl:param>
420 <xsl:param name="default"/>
421 <input type="text" name="{$ns}{@name}" size="30" value="{$default}"/>
422 </xsl:template>
423
424 <!-- large string params -->
425 <xsl:template match="param[@type='text']">
426 <xsl:param name="ns">s1.</xsl:param>
427 <xsl:param name="default"/>
428 <textarea name="{$ns}{@name}" cols="50" rows="3"><xsl:value-of select='$default'/></textarea>
429 </xsl:template>
430
431 <!-- multi params - params that are combinations of other params -->
432 <xsl:template match="param[@type='multi']">
433 <xsl:param name="ns">s1.</xsl:param>
434 <xsl:variable name="parent" select="@name"/>
435
436 <table>
437 <tr class="queryfieldheading">
438 <xsl:value-of select="displayItem[@name='name']"/>
439 <xsl:for-each select="param">
440 <td class="queryfieldname"><xsl:value-of select="displayItem[@name='name']"/></td>
441 </xsl:for-each>
442 </tr>
443 <xsl:apply-templates select="." mode="contents">
444 <xsl:with-param name="occurs" select="@occurs"/>
445 <xsl:with-param name="ns" select="$ns"/>
446 </xsl:apply-templates>
447 </table>
448
449 </xsl:template>
450
451 <xsl:template match="param[@type='multi']" mode="contents">
452 <xsl:param name="ns">s1.</xsl:param>
453 <xsl:param name="occurs">1</xsl:param>
454 <xsl:variable name="pos" select="@occurs - $occurs"/>
455 <tr class="queryfieldrow">
456 <xsl:for-each select="param">
457 <xsl:variable name="pname" select="@name"/>
458 <xsl:variable name="values" select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
459 <td class="queryfieldcell">
460 <xsl:choose>
461 <xsl:when test="not(@ignore) or @ignore != $pos">
462 <xsl:apply-templates select="."><xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($values, $pos)"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>
463 </xsl:when>
464 <xsl:otherwise><!-- put in a hidden placeholder -->
465 <input type="hidden" name='{$ns}{@name}' value=''/>
466 </xsl:otherwise>
467 </xsl:choose>
468 </td>
469 </xsl:for-each>
470 </tr>
471
472 <!-- recursively call this template to get multiple entries -->
473 <xsl:if test="$occurs &gt; 1">
474 <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="$occurs - 1"/><xsl:with-param name="ns" select="$ns"/></xsl:apply-templates>
475 </xsl:if>
476 </xsl:template>
477
478 <xsl:template name="resultsPagePre">
479 <!-- OVERWRITE TO INSERT CONTENT BEFORE THE RESULTS PAGE -->
480 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
481 <xsl:call-template name="mapFeaturesJSONNodes"/>
482 </xsl:if>
483 </xsl:template>
484
485 <xsl:template name="resultsPagePost">
486 <!-- OVERWRITE TO INSERT CONTENT AFTER THE RESULTS PAGE -->
487 </xsl:template>
488
489 <xsl:template name="documentNodePre">
490 <!-- OVERWRITE TO INSERT CONTENT BEFORE EVERY DOCUMENT NODE -->
491 </xsl:template>
492
493 <xsl:template name="documentNodePost">
494 <!-- OVERWRITE TO INSERT CONTENT AFTER EVERY DOCUMENT NODE -->
495 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
496 <xsl:call-template name="mapFeaturesIcon"/>
497 </xsl:if>
498 </xsl:template>
499
500 <xsl:template name="mapFeaturesJSONNodes">
501 <div id="jsonNodes" style="display:none;">
502 <xsl:text>[</xsl:text>
503 <xsl:for-each select="//documentNode">
504 <xsl:if test="metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude']">
505 <xsl:text>{</xsl:text>
506 <xsl:text disable-output-escaping="yes">"nodeID":"</xsl:text><xsl:value-of select="@nodeID"/><xsl:text disable-output-escaping="yes">",</xsl:text>
507 <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>
508 <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>
509 <xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
510 <xsl:text>}</xsl:text>
511 <xsl:if test="not(position() = count(//documentNode))">
512 <xsl:text>,</xsl:text>
513 </xsl:if>
514 </xsl:if>
515 </xsl:for-each>
516 <xsl:text>]</xsl:text>
517 </div>
518
519 <div id="map_canvas" style="margin:0px auto; width:450px; height:500px; float:right;"><xsl:text> </xsl:text></div>
520
521 <gsf:metadata name="Latitude"/>
522 <gsf:metadata name="Longitude"/>
523 </xsl:template>
524
525 <xsl:template name="mapFeaturesIcon">
526 <td style="padding-left:5px; padding-right:5px;" valign="top">
527 <a href="javascript:focusDocument('{@nodeID}');"><img src="interfaces/{$interface_name}/images/bluemarker.png"/></a>
528 </td>
529 </xsl:template>
530</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.