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

Last change on this file since 36261 was 36261, checked in by kjdon, 2 months ago

small changes for snippets (solr). previously the snippet template was outputting <tr>s, but being called inside a <tr>. move the <tr> bit outside of the highlightSnippet template, and make the snippets output as a <ul>

File size: 26.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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:gsvar="http://www.greenstone.org/skinning-var"
8 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
9 extension-element-prefixes="java util"
10 exclude-result-prefixes="java util gsf">
11
12 <!-- use the 'main' layout -->
13 <xsl:import href="layouts/main.xsl"/>
14 <xsl:import href="map-tools.xsl"/>
15 <xsl:import href="panorama-viewer-tools.xsl"/>
16
17 <!-- set page title -->
18 <xsl:template name="pageTitle">
19 <gslib:serviceName/>
20 </xsl:template>
21
22 <!-- set page breadcrumbs -->
23 <xsl:template name="breadcrumbs">
24 <gslib:siteLink/>
25 <gslib:rightArrow/>
26 <xsl:if test="/page/pageResponse/collection">
27 <gslib:collectionNameLinked/>
28 <gslib:rightArrow/>
29 </xsl:if>
30 </xsl:template>
31
32 <!-- do we display the line 'displaying 0 to 20 of 40 documents'-->
33 <!-- on by default. To turn off, add the following in <search> element in collectionConfig.xml:
34 <gsf:option name="hideStatus" value="true"/> -->
35 <xsl:variable name="display_status_bar">
36 <xsl:if test="/page/pageResponse/format[@type='search']/gsf:option[@name='hideStatus']/@value='true'">false</xsl:if></xsl:variable>
37 <!-- the page content -->
38 <xsl:template match="/page">
39 <xsl:if test="not(/page/pageRequest/paramList/param[@name = 'qs']) or /page/pageRequest/paramList/param[@name = 'qs']/@value = ''">
40 <xsl:call-template name="queryPage"/>
41 </xsl:if>
42 <xsl:if test="contains(/page/pageRequest/paramList/param[@name='rt']/@value, 'r')">
43 <xsl:call-template name="resultsPage"/>
44 </xsl:if>
45 </xsl:template>
46
47 <xsl:template name="resultsPage">
48 <xsl:call-template name="floatRightSidebar"/>
49 <xsl:call-template name="resultsPagePre"/>
50 <xsl:call-template name="displayMatchDocs"/>
51 <xsl:call-template name="displayTermInfo"/>
52 <xsl:call-template name="displayResults"/>
53 <xsl:call-template name="resultsPagePost"/>
54 </xsl:template>
55
56 <!-- optional cgi-params for links to document pages -->
57 <xsl:variable name="opt-doc-link-args">p.s=<gsvar:this-service/><xsl:if test="/page/pageRequest/paramList/param[@name ='s1.collection']">&amp;ck=TextQuery</xsl:if>
58 </xsl:variable>
59
60 <xsl:template name="rightSidebar">
61 <div id="rightSidebar">
62 <xsl:comment>Filler to prevent empty div collapse, in event displayBasket empty</xsl:comment>
63
64 <gslib:displayBaskets/>
65
66 <xsl:if test="/page/pageResponse/facetList/facet/count">
67 <xsl:call-template name="displayFacets"/>
68 </xsl:if>
69
70 </div>
71 </xsl:template>
72
73 <xsl:template name="displayResults">
74 <div id="resultsArea">
75 <xsl:attribute name="class">
76 <xsl:if test="/page/pageResponse/facetList/facet/count">facetedResults</xsl:if>
77 </xsl:attribute>
78 <table id="resultsTable">
79 <xsl:for-each select="pageResponse/documentNodeList/documentNode">
80 <tr id="div{@nodeID}" class="document">
81 <!-- the favourites star-->
82 <xsl:if test="$favouriteBasketOn">
83 <td valign="top">
84 <xsl:call-template name="documentFavouriteForClassifierOrSearchPage"/>
85 </td>
86 </xsl:if>
87
88 <!-- The node contents -->
89 <xsl:apply-templates select="."/>
90 <xsl:call-template name="documentNodePost"/>
91 </tr>
92 <!-- for solr, this adds another row with the snippet info -->
93 <tr><td colspan="5">
94 <xsl:call-template name="highlightSnippet">
95 <xsl:with-param name="nodeHASH">
96 <xsl:value-of select="@nodeID"/>
97 </xsl:with-param>
98 <xsl:with-param name="collection" select="@collection"/>
99 <!--<xsl:choose> <xsl:when test="@collection"><xsl:value-of select="@collection"/></xsl:with-param>-->
100 </xsl:call-template>
101 </td></tr>
102 </xsl:for-each>
103 <br/>
104 </table>
105
106 <!-- Previous/Next buttons-->
107 <xsl:call-template name="prevNextButtons"/>
108 </div>
109 <xsl:if test="/page/pageResponse/facetList/facet/count">
110 <div style="clear:both;">
111 <xsl:text> </xsl:text>
112 </div>
113 </xsl:if>
114 </xsl:template>
115
116 <xsl:template name="displayFacets">
117 <script type="text/javascript" src="interfaces/{$interface_name}/js/utility_scripts.js"><xsl:text> </xsl:text></script>
118 <script type="text/javascript" src="interfaces/{$interface_name}/js/facet-scripts.js">
119 <xsl:text> </xsl:text>
120 </script>
121
122 <div id="facetSelector" >
123 <xsl:for-each select="/page/pageResponse/facetList/facet">
124 <xsl:if test="count(count) > 0">
125 <ul class="facetTable ui-widget-content" indexName="{@name}">
126 <xsl:variable name="serviceName">
127 <xsl:value-of select="/page/pageRequest/paramList/param[@name = 's']/@value"/>
128 </xsl:variable>
129 <xsl:variable name="indexShortName">
130 <xsl:value-of select="@name"/>
131 </xsl:variable>
132 <xsl:variable name="countSize">
133 <xsl:choose>
134 <xsl:when test="/page/pageResponse/format[@type='search']/gsf:option[@name='facetTableRows']">
135 <xsl:value-of select="/page/pageResponse/format[@type='search']/gsf:option[@name='facetTableRows']/@value"/>
136 </xsl:when>
137 <xsl:otherwise>8</xsl:otherwise>
138 </xsl:choose>
139 </xsl:variable>
140
141 <li class="ui-widget-header" style="text-transform:capitalize; text-align:center;">
142 <xsl:value-of select="displayItem[@name='name']"/>
143 </li>
144 <xsl:for-each select="count">
145 <li>
146 <xsl:attribute name="style">
147 <xsl:if test="position() > $countSize">display:none;<xsl:value-of select="$indexShortName"/>
148 </xsl:if>
149 </xsl:attribute>
150 <input type="checkbox" onclick="performRefinedSearch();"/>
151 <span>
152 <xsl:value-of select="@name"/>
153 </span>(<xsl:value-of select="."/>)
154 </li>
155 </xsl:for-each>
156 <xsl:if test="count(count) > $countSize">
157 <li class="expandFacetList{$indexShortName}">
158 <a class="expandFacetListLink{$indexShortName}" href="javascript:expandFacetList('{$indexShortName}', {$countSize});"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.facet.more')"/></a>
159 </li>
160 <li class="collapseFacetList{$indexShortName}" style="display: none;">
161 <a class="collapseFacetListLink{$indexShortName}" href="javascript:collapseFacetList('{$indexShortName}', {$countSize});"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.facet.less')"/></a>
162 </li>
163 </xsl:if>
164 </ul>
165 </xsl:if>
166 </xsl:for-each>
167 </div>
168 </xsl:template>
169
170 <!-- this usually gets overriden in collectionConfig.xml -->
171 <xsl:template match="documentNode">
172 <td valign="top">
173 <gsf:link type="document">
174 <gsf:icon type="document"/>
175 </gsf:link>
176 </td>
177 <td>
178 <gsf:link type="document">
179 <xsl:call-template name="choose-title"/>
180 </gsf:link>
181 </td>
182 </xsl:template>
183
184 <xsl:template name="highlightSnippet">
185 <xsl:param name="nodeHASH"/>
186 <xsl:param name="collection"/>
187 <xsl:if test="/page/pageResponse/highlightSnippetList/highlightSnippet[@nodeID = $nodeHASH]">
188 <ul style="list-style-type:none">
189 <xsl:for-each select="/page/pageResponse/highlightSnippetList/highlightSnippet[@nodeID = $nodeHASH]">
190 <xsl:if test="not($collection) or $collection = @collection">
191 <li class="HighlightSnippet">
192 <xsl:value-of select="." disable-output-escaping="yes"/>
193 </li>
194 </xsl:if>
195 </xsl:for-each>
196 </ul>
197 </xsl:if>
198
199 </xsl:template>
200
201 <xsl:template name="queryPage">
202 <xsl:for-each select="pageResponse/service">
203 <xsl:variable name="form_action"><xsl:value-of select="$library_name"/>/<xsl:if test="$collName">collection/<xsl:value-of select="$collName"/>/</xsl:if>search/<xsl:value-of select="@name"/></xsl:variable>
204 <form name="QueryForm" method="get" action="{$form_action}">
205 <div>
206 <input type="hidden" name="a" value="q"/>
207 <input type="hidden" name="sa">
208 <xsl:attribute name="value">
209 <xsl:value-of select="/page/pageRequest/@subaction"/>
210 </xsl:attribute>
211 </input>
212 <input type="hidden" name="rt" value="rd"/>
213
214 <xsl:variable name="ns">s1.</xsl:variable>
215 <xsl:choose>
216 <xsl:when test="/page/pageResponse/hierarchy and paramList/param[@name ='collection']">
217 <xsl:call-template name="CCSParams"> <!-- cross coll search -->
218 <xsl:with-param name="ns" select="$ns" />
219 </xsl:call-template>
220 </xsl:when>
221 <xsl:otherwise>
222 <xsl:for-each select="paramList/param">
223 <xsl:choose>
224 <xsl:when test="@type='multi'">
225 <xsl:apply-templates select=".">
226 <xsl:with-param name="ns" select="$ns"/>
227 </xsl:apply-templates>
228 </xsl:when>
229 <xsl:otherwise>
230 <xsl:call-template name="param-display">
231 <xsl:with-param name="ns" select="$ns"/>
232 </xsl:call-template>
233 </xsl:otherwise>
234 </xsl:choose>
235 </xsl:for-each>
236 </xsl:otherwise>
237 </xsl:choose>
238 <br/>
239 <input type="submit">
240 <xsl:attribute name="value">
241 <xsl:value-of select="displayItem[@name='submit']"/>
242 </xsl:attribute>
243 </input>
244 </div>
245 </form>
246 </xsl:for-each>
247 </xsl:template>
248
249 <xsl:template name="CCSParams">
250
251 <xsl:param name="ns" />
252 <xsl:variable name="currentSelection"><xsl:value-of select="util:getFormattedCCSSelection(/page/pageRequest/paramList/param[@name='s1.collection']/@value,/page/pageRequest/paramList/param[@name='s1.group']/@value)"/></xsl:variable>
253 <!-- display the collection param -->
254 <div class="paramLabel">
255 <xsl:value-of select="paramList/param[@name='collection']/displayItem[@name='name']/text()" />
256 </div>
257 <div class="paramValue">
258 <select multiple="" size='10'>
259 <xsl:attribute name="name">
260 <xsl:value-of select="$ns"></xsl:value-of>
261 <xsl:text>collection</xsl:text>
262 </xsl:attribute>
263 <xsl:for-each select="/page/pageResponse/hierarchy/*">
264 <xsl:call-template name="hierarchy-display">
265 <xsl:with-param name="padding">0</xsl:with-param>
266 <xsl:with-param name="currentSelection" select="$currentSelection"/>
267 </xsl:call-template>
268 </xsl:for-each>
269 </select>
270 </div>
271 <br class="clear" />
272 <!-- display all the other params -->
273 <xsl:for-each select="paramList/param[@name !='collection']">
274 <xsl:choose>
275 <xsl:when test="@type='multi'">
276 <xsl:apply-templates select=".">
277 <xsl:with-param name="ns" select="$ns"/>
278 </xsl:apply-templates>
279 </xsl:when>
280 <xsl:otherwise>
281 <xsl:call-template name="param-display">
282 <xsl:with-param name="ns" select="$ns"/>
283 </xsl:call-template>
284 </xsl:otherwise>
285 </xsl:choose>
286 </xsl:for-each>
287 </xsl:template>
288
289 <xsl:template name="hierarchy-display">
290 <xsl:param name="padding" />
291 <xsl:param name="path" />
292 <xsl:param name="currentSelection"/>
293 <xsl:choose>
294 <xsl:when test="name(.) = 'group'">
295 <xsl:variable name="group-name">group.<xsl:if test="$path"><xsl:value-of select="$path" />.</xsl:if><xsl:value-of select="@name" /></xsl:variable>
296 <option>
297 <xsl:attribute name="style">
298 <xsl:text>padding-left: </xsl:text>
299 <xsl:value-of select="concat($padding,'px')" />
300 </xsl:attribute>
301 <xsl:attribute name="value"><xsl:value-of select="$group-name"/></xsl:attribute>
302 <xsl:if test="util:csvContains($currentSelection, $group-name)">
303 <xsl:attribute name="selected">selected</xsl:attribute>
304 </xsl:if>
305 <xsl:value-of select="@title"></xsl:value-of>
306 <xsl:for-each select="./*">
307 <xsl:call-template name="hierarchy-display">
308 <xsl:with-param name="padding">
309 <xsl:value-of select="$padding + 20" />
310 </xsl:with-param>
311 <xsl:with-param name="path"><xsl:if test="$path"><xsl:value-of select="$path" />.</xsl:if><xsl:value-of select="../@name" /></xsl:with-param>
312 <xsl:with-param name="currentSelection" select="$currentSelection"/>
313 </xsl:call-template>
314 </xsl:for-each>
315 </option>
316 </xsl:when>
317 <xsl:otherwise>
318 <option>
319 <xsl:attribute name="style">
320 <xsl:text>padding-left: </xsl:text>
321 <xsl:value-of select="$padding" />
322 <xsl:text>px</xsl:text>
323 </xsl:attribute>
324 <xsl:if test="util:csvContains($currentSelection, @name)">
325 <xsl:attribute name="selected">selected</xsl:attribute>
326 </xsl:if>
327 <xsl:attribute name="value">
328 <xsl:value-of select="current()/@name"></xsl:value-of>
329 </xsl:attribute>
330 <xsl:value-of
331 select="/page/pageResponse/service[@name = 'TextQuery']/paramList/param[@name = 'collection']/option[@name = current()/@name]/displayItem[@name = 'name']/text()"></xsl:value-of>
332 </option>
333 </xsl:otherwise>
334 </xsl:choose>
335 </xsl:template>
336
337 <xsl:template name="displayMatchDocs">
338 <div id="matchdocs">
339 <xsl:variable name="numDocsMatched" select="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']"/>
340 <xsl:variable name="numDocsReturned" select="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']"/>
341 <xsl:variable name="docLevel">
342 <xsl:call-template name="documentLevel"/>
343 </xsl:variable>
344 <xsl:variable name="docLevelText">
345 <xsl:call-template name="documentLevelText">
346 <xsl:with-param name="numDocsMatched" select="$numDocsMatched"/>
347 <xsl:with-param name="level" select="$docLevel"/>
348 </xsl:call-template>
349 </xsl:variable>
350 <xsl:choose>
351 <xsl:when test="$numDocsMatched='0' or $numDocsReturned='0'">
352 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch', $docLevelText)"/>
353 </xsl:when>
354 <xsl:when test="$numDocsMatched='1' or $numDocsReturned='1'">
355 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch', $docLevelText)"/>
356 </xsl:when>
357 <xsl:when test="$numDocsMatched">
358 <xsl:variable name="gitArgs1" select="concat($numDocsMatched, ';', $docLevelText)"/>
359 <xsl:variable name="gitArgs2" select="concat($numDocsReturned, ';', $docLevelText)"/>
360
361 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', $gitArgs1)"/>
362 <xsl:if test="$numDocsReturned and not($numDocsMatched=$numDocsReturned)"> (<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.docsreturned', $gitArgs2)"/>)</xsl:if>
363 </xsl:when>
364 <xsl:when test="$numDocsReturned">
365 <xsl:variable name="gitArgs" select="concat($numDocsReturned, ';', $docLevelText)"/>
366 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.atleastdocsmatch', $gitArgs)"/>
367 </xsl:when>
368 </xsl:choose>
369 </div>
370
371 </xsl:template>
372
373 <xsl:template name="documentLevel">
374 <xsl:choose>
375 <xsl:when test="/page/pageRequest/paramList/param[@name='level']">
376 <xsl:value-of select="/page/pageRequest/paramList/param[@name='level']/@value" />
377 </xsl:when>
378 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.level']">
379 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.level']/@value" />
380 </xsl:when>
381 <xsl:otherwise>Doc</xsl:otherwise>
382 </xsl:choose>
383 </xsl:template>
384
385 <xsl:template name="documentLevelText">
386 <xsl:param name="numDocsMatched">0</xsl:param>
387 <xsl:param name="level">Doc</xsl:param>
388 <xsl:choose>
389 <xsl:when test="$numDocsMatched = 1">
390 <xsl:choose>
391 <xsl:when test="$level = 'Doc'">
392 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
393 </xsl:when>
394 <xsl:otherwise>
395 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section')"/>
396 </xsl:otherwise>
397 </xsl:choose>
398 </xsl:when>
399 <!-- 0 or more than one use plural. is that the case for all langs??-->
400 <xsl:otherwise>
401 <xsl:choose>
402 <xsl:when test="$level = 'Doc'">
403 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
404 </xsl:when>
405 <xsl:otherwise>
406 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
407 </xsl:otherwise>
408 </xsl:choose>
409 </xsl:otherwise>
410 </xsl:choose>
411 </xsl:template>
412
413 <xsl:template name="displayTermInfo">
414
415 <!-- Find the number of documents displayed per page -->
416 <xsl:variable name="level">
417 <xsl:call-template name="documentLevel"/>
418 </xsl:variable>
419
420 <!-- The list of search terms with their frequency and document count -->
421 <p class="termList">
422 <xsl:if test="count(/page/pageResponse/termList/stopword) &gt; 0">
423 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.common')"/>
424 <xsl:text> </xsl:text>
425 <xsl:for-each select="/page/pageResponse/termList/stopword">
426 <span style="font-style:italic;">
427 <xsl:value-of select="@name"/>
428 </span>
429 <xsl:text> </xsl:text>
430 </xsl:for-each>
431 <br />
432 <br />
433 </xsl:if>
434
435 <!-- If there is only one or two search terms then show the expanded information -->
436 <xsl:choose>
437 <xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
438
439 <xsl:for-each select="/page/pageResponse/termList/term">
440 <xsl:variable name="levelText">
441 <!-- this gets document, section, documents, sections, depending on level and number -->
442 <xsl:call-template name="documentLevelText">
443 <xsl:with-param name="level" select="$level"/>
444 <xsl:with-param name="numDocsMatched" select="@numDocsMatch"/>
445 </xsl:call-template>
446 </xsl:variable>
447 <span class="termInfo">
448
449 <!-- For solr and mg collections, display:
450 term x occured y times
451 term a occured b times
452 For collections using all other indexers, display:
453 term x occurred y times in n sections/documents
454 term a occurred b times in m sections/docs
455 -->
456 <!-- not all these args are used in every case -->
457 <xsl:variable name="args" select="concat(@name,';', @freq, ';', @numDocsMatch,';', $levelText)"/>
458 <xsl:choose>
459 <xsl:when test="@freq = 0">
460 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.0',$args)"/>
461 </xsl:when>
462 <xsl:when test="@freq = 1">
463 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.1',$args)"/>
464 </xsl:when>
465 <xsl:otherwise> <!-- more than one occurrance -->
466 <xsl:choose>
467 <xsl:when test="/page/pageResponse/collection[@type = 'solr'] or /page/pageResponse/collection[@type = 'mg']">
468 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x',$args)"/>
469 </xsl:when>
470 <xsl:when test="@numDocsMatch = 1">
471 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.1',$args)"/>
472 </xsl:when>
473 <xsl:otherwise>
474 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.termoccurs.x.x',$args)"/>
475 </xsl:otherwise>
476 </xsl:choose>
477 </xsl:otherwise>
478 </xsl:choose>
479
480 </span>
481 <br/>
482 </xsl:for-each>
483 </xsl:when>
484 <xsl:otherwise>
485 <xsl:for-each select="/page/pageResponse/termList/term">
486 <span style="font-style:italic;">
487 <xsl:value-of select="@name"/>
488 </span> (<xsl:value-of select="@freq"/>)
489 </xsl:for-each>
490 </xsl:otherwise>
491 </xsl:choose>
492 </p>
493 </xsl:template>
494
495 <xsl:template name="prevNextButtons">
496 <!-- Current page -->
497 <xsl:variable name="currentPage">
498 <xsl:choose>
499 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.startPage']/@value">
500 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.startPage']/@value" />
501 </xsl:when>
502 <xsl:when test="/page/pageRequest/paramList/param[@name='startPage']/@value">
503 <xsl:value-of select="/page/pageRequest/paramList/param[@name='startPage']/@value" />
504 </xsl:when>
505 <xsl:otherwise>1</xsl:otherwise>
506 </xsl:choose>
507 </xsl:variable>
508 <xsl:variable name="usesS1">
509 <xsl:choose>
510 <xsl:when test="/page/pageResponse/service/paramList/param[@name='startPage']">true</xsl:when>
511 <xsl:otherwise>false</xsl:otherwise>
512 </xsl:choose>
513 </xsl:variable>
514 <!-- Find the total number of documents returned/matched -->
515 <xsl:variable name="docMax">
516 <xsl:choose>
517 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
518 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
519 </xsl:when>
520 <xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']">
521 <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']"/>
522 </xsl:when>
523 <xsl:otherwise>
524 <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
525 </xsl:otherwise>
526 </xsl:choose>
527 </xsl:variable>
528 <!-- Find the number of documents displayed per page -->
529 <xsl:variable name="docsPerPage">
530 <xsl:choose>
531 <xsl:when test="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']">
532 <xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']/@value" />
533 </xsl:when>
534 <xsl:when test="/page/pageResponse/service/paramList/param[@name='hitsPerPage']">
535 <xsl:value-of select="/page/pageResponse/service/paramList/param[@name='hitsPerPage']/@default" />
536 </xsl:when>
537 <xsl:otherwise><xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/></xsl:otherwise>
538 </xsl:choose>
539 </xsl:variable>
540 <!-- Find the level -->
541 <xsl:variable name="level">
542 <xsl:call-template name="documentLevel"/>
543 </xsl:variable>
544 <!-- we only need this if number of docs > docsperpage -->
545 <xsl:if test="$docMax &gt; $docsPerPage">
546 <table id="searchResultNavTable">
547 <tr>
548 <xsl:variable name="startPageName">
549 <xsl:if test="$usesS1 = 'true'">s1.</xsl:if>startPage</xsl:variable>
550
551 <!-- Previous button -->
552 <td id="prevArrowTD">
553 <xsl:if test="$currentPage != 1">
554 <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}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">
555 <xsl:call-template name="previousArrowImage"/>
556 </a>
557 </xsl:if>
558 </td>
559 <td id="prevTD">
560 <xsl:if test="$currentPage != 1">
561 <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}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.results.previous')"/></a>
562 </xsl:if>
563 </td>
564
565 <xsl:if test="$display_status_bar != 'false'">
566 <!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
567 <xsl:if test="$docsPerPage &gt; 0">
568 <xsl:variable name="startdoc" select="($currentPage - 1) * $docsPerPage + 1"/>
569 <xsl:variable name="enddoc">
570 <xsl:choose>
571 <xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
572 <xsl:value-of select="$docMax"/>
573 </xsl:when>
574 <xsl:otherwise>
575 <xsl:value-of select="$currentPage * $docsPerPage"/>
576 </xsl:otherwise>
577 </xsl:choose>
578 </xsl:variable>
579 <xsl:variable name="levelString">
580 <xsl:choose>
581 <xsl:when test="$level = 'Doc'">
582 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
583 </xsl:when>
584 <xsl:otherwise>
585 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.section_plural')"/>
586 </xsl:otherwise>
587 </xsl:choose>
588 </xsl:variable>
589 <td id="searchResultsStatusBar">
590 <xsl:variable name="gitArgs" select="concat($startdoc,';', $enddoc, ';', $docMax, ';', $levelString)"/>
591 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displayingnumdocs', $gitArgs)"/>
592 </td>
593 </xsl:if>
594 </xsl:if>
595 <!-- Next button -->
596 <td id="nextTD">
597 <xsl:if test="$docsPerPage &gt; 0 and ($currentPage * $docsPerPage) &lt; $docMax">
598 <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}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.results.next')"/></a>
599 </xsl:if>
600 </td>
601 <td id="nextArrowTD">
602 <xsl:if test="$docsPerPage &gt; 0 and ($currentPage * $docsPerPage) &lt; $docMax">
603 <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}&amp;qs={/page/pageRequest/paramList/param[@name='qs']/@value}">
604 <xsl:call-template name="nextArrowImage"/>
605 </a>
606 </xsl:if>
607 </td>
608 </tr>
609 </table>
610 </xsl:if>
611 </xsl:template>
612
613 <xsl:template name="previousArrowImage">
614 <img src="interfaces/{$interface_name}/images/previous.png"/>
615 </xsl:template>
616 <xsl:template name="nextArrowImage">
617 <img src="interfaces/{$interface_name}/images/next.png"/>
618 </xsl:template>
619 <!-- puts all the params into a=p&p=h type form - need to change this if use
620 multi params -->
621 <xsl:template match="paramList" mode="cgi">
622 <xsl:param name="ns">s1.</xsl:param>
623 <xsl:for-each select="param">
624 <xsl:variable name='pname' select="@name"/>
625 <xsl:text>&amp;</xsl:text>
626 <xsl:value-of select="$ns"/>
627 <xsl:value-of select="@name"/>=<xsl:apply-templates select="." mode="calculate-default">
628 <xsl:with-param name='ns' select='$ns'/>
629 </xsl:apply-templates>
630 </xsl:for-each>
631 </xsl:template>
632
633 <xsl:template name="resultsPagePre">
634 <!-- OVERWRITE TO INSERT CONTENT BEFORE THE RESULTS PAGE -->
635 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
636 <xsl:call-template name="mapFeaturesJSONNodes"/>
637 <xsl:call-template name="mapFeaturesMap"/>
638 </xsl:if>
639 </xsl:template>
640
641 <xsl:template name="resultsPagePost">
642 <!-- OVERWRITE TO INSERT CONTENT AFTER THE RESULTS PAGE -->
643 </xsl:template>
644
645 <xsl:template name="documentNodePre">
646 <!-- OVERWRITE TO INSERT CONTENT BEFORE EVERY DOCUMENT NODE -->
647 </xsl:template>
648
649 <xsl:template name="documentNodePost">
650 <!-- OVERWRITE TO INSERT CONTENT AFTER EVERY DOCUMENT NODE -->
651 <xsl:if test="/page/pageResponse/format[@type='display' or @type='browse' or @type='search']/gsf:option[@name='mapEnabled']/@value = 'true'">
652 <xsl:call-template name="mapFeaturesIcon"/>
653 </xsl:if>
654
655 <xsl:if test="/page/pageResponse/format/gsf:option[@name='panoramaViewerEnabled']/@value = 'true'">
656 <xsl:if test=" metadataList/metadata[@name = 'Coordinate'] or ( metadataList/metadata[@name = 'Latitude'] and metadataList/metadata[@name = 'Longitude'])">
657 <xsl:call-template name="panoramaViewerFeaturesIcon"/>
658 </xsl:if>
659 </xsl:if>
660
661 </xsl:template>
662
663
664
665</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.