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 | extension-element-prefixes="java util"
|
---|
7 | exclude-result-prefixes="java util">
|
---|
8 |
|
---|
9 | <!-- have changed this so it uses service hitsPerPage and startPage if the service description has a param called hitsPerPage, otherwise uses interface ones -->
|
---|
10 | <xsl:template name="resultNavigation">
|
---|
11 | <!-- hits type -->
|
---|
12 | <xsl:variable name='ht'>
|
---|
13 | <xsl:choose>
|
---|
14 | <xsl:when test="/page/pageResponse/service/paramList/param[@name='hitsPerPage']">s</xsl:when>
|
---|
15 | <xsl:otherwise>i</xsl:otherwise>
|
---|
16 | </xsl:choose>
|
---|
17 | </xsl:variable>
|
---|
18 |
|
---|
19 | <xsl:variable name="param-list" select="/page/pageRequest/paramList"/>
|
---|
20 | <!-- hits per page -->
|
---|
21 | <xsl:variable name="hpp">
|
---|
22 | <xsl:choose>
|
---|
23 | <xsl:when test="$ht='s'"><xsl:value-of select="$param-list/param[@name='s1.hitsPerPage']/@value"/></xsl:when>
|
---|
24 | <xsl:when test="$param-list/param[@name='hitsPerPage']"><xsl:value-of select="$param-list/param[@name='hitsPerPage']/@value"/></xsl:when>
|
---|
25 | <xsl:otherwise>20</xsl:otherwise>
|
---|
26 | </xsl:choose>
|
---|
27 | </xsl:variable>
|
---|
28 | <!-- total docs - this may be in numDocsMatched or numDocsReturned metadata -->
|
---|
29 | <xsl:variable name="td">
|
---|
30 | <xsl:choose>
|
---|
31 | <xsl:when test="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']">
|
---|
32 | <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']"/>
|
---|
33 | </xsl:when>
|
---|
34 | <xsl:when test="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']">
|
---|
35 | <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='numDocsMatched']"/>
|
---|
36 | </xsl:when>
|
---|
37 | <xsl:otherwise> <!-- this is just a fall back - shoudl always have the metadata -->
|
---|
38 | <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
|
---|
39 | </xsl:otherwise>
|
---|
40 | </xsl:choose>
|
---|
41 | </xsl:variable>
|
---|
42 |
|
---|
43 | <!-- only continue if hpp != -1 and td > hpp -->
|
---|
44 | <xsl:if test="not($hpp=-1) and $td > $hpp">
|
---|
45 | <!-- start page -->
|
---|
46 | <xsl:variable name="here">
|
---|
47 | <xsl:choose>
|
---|
48 | <xsl:when test="$ht='s'"><xsl:value-of select="$param-list/param[@name='s1.startPage']/@value"/></xsl:when>
|
---|
49 | <xsl:when test="$param-list/param[@name='startPage']"><xsl:value-of select="$param-list/param[@name='startPage']/@value"/></xsl:when>
|
---|
50 | <xsl:otherwise>1</xsl:otherwise>
|
---|
51 | </xsl:choose>
|
---|
52 | </xsl:variable>
|
---|
53 | <xsl:variable name="sa" select="/page/pageRequest/@subaction"/>
|
---|
54 | <xsl:variable name="service" select="$param-list/param[@name='s']/@value"/>
|
---|
55 | <xsl:variable name="prev" select="$here - 1"/>
|
---|
56 | <xsl:variable name="next" select="$here + 1"/>
|
---|
57 | <xsl:variable name="page-param"><xsl:if test="$ht='s'">s1.</xsl:if>startPage</xsl:variable>
|
---|
58 | <p />
|
---|
59 | <center>
|
---|
60 | <table cellspacing='0' cellpadding='0' width='70%'>
|
---|
61 | <tr>
|
---|
62 | <td align='left'>
|
---|
63 | <xsl:if test="$here > 1"><a href="{$library_name}?a=q&sa={$sa}&s={$service}&rt=r&{$page-param}={$prev}"><img src="interfaces/default/images/less.gif" width='30' height='16' border='0' align='top'/><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($prev - 1)*$hpp + 1)"/> - <xsl:value-of select="number(($prev * $hpp))"/></a></xsl:if>
|
---|
64 | </td>
|
---|
65 | <td align='right'>
|
---|
66 | <xsl:if test="(($here * $hpp) + 1) < $td">
|
---|
67 | <xsl:variable name='m' select="number($next * $hpp)"/>
|
---|
68 | <xsl:variable name='mm'><xsl:choose><xsl:when test="$m < $td"><xsl:value-of select='$m'/></xsl:when><xsl:otherwise><xsl:value-of select='$td'/></xsl:otherwise></xsl:choose></xsl:variable>
|
---|
69 | <a href="{$library_name}?a=q&sa={$sa}&s={$service}&rt=r&{$page-param}={$next}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($next - 1)*$hpp + 1)"/> - <xsl:value-of select="$mm"/><img src="interfaces/default/images/more.gif" width='30' height='16' border='0' align='top'/></a></xsl:if></td> </tr>
|
---|
70 | </table>
|
---|
71 | </center>
|
---|
72 | </xsl:if>
|
---|
73 | </xsl:template>
|
---|
74 |
|
---|
75 | <xsl:template name="matchDocs">
|
---|
76 | <!-- If the number of matching documents is known, display it -->
|
---|
77 | <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']"/>
|
---|
78 | <xsl:variable name="numDocsReturned" select="metadataList/metadata[@name='numDocsReturned']"/>
|
---|
79 | <xsl:choose>
|
---|
80 | <xsl:when test="$numDocsMatched='0' or $numDocsReturned='0'">
|
---|
81 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch')"/>
|
---|
82 | </xsl:when>
|
---|
83 | <xsl:when test="$numDocsMatched='1' or $numDocsReturned='0'">
|
---|
84 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch')"/>
|
---|
85 | </xsl:when>
|
---|
86 | <xsl:when test="$numDocsMatched">
|
---|
87 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', $numDocsMatched)"/>
|
---|
88 | <xsl:if test="$numDocsReturned"> (<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.docsreturned', $numDocsReturned)"/>)</xsl:if>
|
---|
89 | </xsl:when>
|
---|
90 | <xsl:when test="$numDocsReturned">
|
---|
91 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.atleastdocsmatch', $numDocsReturned)"/>
|
---|
92 | </xsl:when>
|
---|
93 | </xsl:choose>
|
---|
94 | </xsl:template>
|
---|
95 |
|
---|
96 | <!-- paging is now done by the query action, so here we just print out all the docs that we have -->
|
---|
97 | <xsl:template name="resultList">
|
---|
98 | <xsl:param name="collName"/>
|
---|
99 | <table>
|
---|
100 | <xsl:for-each select="documentNodeList/documentNode">
|
---|
101 | <tr>
|
---|
102 | <xsl:apply-templates select=".">
|
---|
103 | <xsl:with-param name="collName" select="$collName"/>
|
---|
104 | </xsl:apply-templates>
|
---|
105 | </tr>
|
---|
106 | </xsl:for-each>
|
---|
107 | </table>
|
---|
108 | </xsl:template>
|
---|
109 |
|
---|
110 |
|
---|
111 | <!-- the default doc node template for the query results -->
|
---|
112 | <!-- eventually shouldn't need sib arg here -->
|
---|
113 | <xsl:template match="documentNode">
|
---|
114 | <xsl:param name="collName"/>
|
---|
115 | <td>
|
---|
116 | <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&c=<xsl:value-of select='$collName'/>&d=<xsl:value-of select='@nodeID'/><xsl:if test="@nodeType='leaf'">&sib=1</xsl:if>&dt=<xsl:value-of select='@docType'/>&p.a=q&&p.sa=<xsl:value-of select="/page/pageRequest/@subaction"/>&p.s=<xsl:value-of select="/page/pageResponse/service/@name"/></xsl:attribute>
|
---|
117 | <xsl:apply-templates select="." mode="displayNodeIcon"/>
|
---|
118 | </a>
|
---|
119 | </td>
|
---|
120 | <td><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></td>
|
---|
121 | </xsl:template>
|
---|
122 |
|
---|
123 | <xsl:template name="termInfo">
|
---|
124 | <xsl:if test="count(termList/term) > 0">
|
---|
125 | <small>
|
---|
126 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.wordcount')"/>
|
---|
127 | <xsl:for-each select="termList/term">
|
---|
128 | <xsl:if test="position() > 1">, </xsl:if>
|
---|
129 | <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
|
---|
130 | </xsl:for-each>
|
---|
131 | </small>
|
---|
132 | <br/>
|
---|
133 | </xsl:if>
|
---|
134 | </xsl:template>
|
---|
135 |
|
---|
136 | </xsl:stylesheet>
|
---|
137 |
|
---|
138 |
|
---|