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

Last change on this file since 31655 was 31655, checked in by kjdon, 4 years ago

query-common has been renamed to shared-templates, and is inluced by header which is included by main, so don't need to include it here

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