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

Last change on this file since 25704 was 25704, checked in by kjdon, 12 years ago

renaming interfaces step 2: oran interface renamed to default. oran paths fixed up

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