[4255] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <xsl:stylesheet version="1.0"
|
---|
[4712] | 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">
|
---|
[4255] | 8 |
|
---|
[5194] | 9 | <!-- have changed this so it uses service hitsPerPage and startPage if the service description has a param called hitsPerPage, otherwise uses interface ones -->
|
---|
[4728] | 10 | <xsl:template name="resultNavigation">
|
---|
[5194] | 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 |
|
---|
[5134] | 19 | <xsl:variable name="param-list" select="/page/pageRequest/paramList"/>
|
---|
| 20 | <!-- hits per page -->
|
---|
| 21 | <xsl:variable name="hpp">
|
---|
| 22 | <xsl:choose>
|
---|
[5194] | 23 | <xsl:when test="$ht='s'"><xsl:value-of select="$param-list/param[@name='s1.hitsPerPage']/@value"/></xsl:when>
|
---|
[5134] | 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>
|
---|
[5194] | 28 | <!-- total docs - this may be in numDocsMatched or numDocsReturned metadata -->
|
---|
[5134] | 29 | <xsl:variable name="td">
|
---|
| 30 | <xsl:choose>
|
---|
[5194] | 31 | <xsl:when test="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']">
|
---|
| 32 | <xsl:value-of select="/page/pageResponse/metadataList/metadata[@name='numDocsReturned']"/>
|
---|
[5134] | 33 | </xsl:when>
|
---|
[5194] | 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 -->
|
---|
[5134] | 38 | <xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/>
|
---|
[5194] | 39 | </xsl:otherwise>
|
---|
[5134] | 40 | </xsl:choose>
|
---|
| 41 | </xsl:variable>
|
---|
[5194] | 42 |
|
---|
[5134] | 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>
|
---|
[5194] | 48 | <xsl:when test="$ht='s'"><xsl:value-of select="$param-list/param[@name='s1.startPage']/@value"/></xsl:when>
|
---|
[5134] | 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>
|
---|
[4712] | 53 | <xsl:variable name="sa" select="/page/pageRequest/@subaction"/>
|
---|
[5134] | 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>
|
---|
[4270] | 58 | <p />
|
---|
| 59 | <center>
|
---|
[5134] | 60 | <table cellspacing='0' cellpadding='0' width='70%'>
|
---|
[4270] | 61 | <tr>
|
---|
| 62 | <td align='left'>
|
---|
[5134] | 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>
|
---|
[4270] | 64 | </td>
|
---|
| 65 | <td align='right'>
|
---|
[5134] | 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>
|
---|
[4270] | 70 | </table>
|
---|
| 71 | </center>
|
---|
| 72 | </xsl:if>
|
---|
[4255] | 73 | </xsl:template>
|
---|
[5194] | 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>
|
---|
[4728] | 95 |
|
---|
[5194] | 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"/>
|
---|
[5703] | 104 | <xsl:with-param name="serviceName" select="/page/pageResponse/service/@name"/>
|
---|
[5194] | 105 | </xsl:apply-templates>
|
---|
| 106 | </tr>
|
---|
| 107 | </xsl:for-each>
|
---|
| 108 | </table>
|
---|
| 109 | </xsl:template>
|
---|
| 110 |
|
---|
| 111 |
|
---|
[4728] | 112 | <!-- the default doc node template for the query results -->
|
---|
| 113 | <!-- eventually shouldn't need sib arg here -->
|
---|
| 114 | <xsl:template match="documentNode">
|
---|
[6001] | 115 | <xsl:param name="collName"/>
|
---|
[5703] | 116 | <xsl:param name="serviceName"/>
|
---|
[4728] | 117 | <td>
|
---|
[5703] | 118 | <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="$serviceName"/></xsl:attribute>
|
---|
[4728] | 119 | <xsl:apply-templates select="." mode="displayNodeIcon"/>
|
---|
| 120 | </a>
|
---|
| 121 | </td>
|
---|
[4866] | 122 | <td><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></td>
|
---|
[4728] | 123 | </xsl:template>
|
---|
[5134] | 124 |
|
---|
[4879] | 125 | <xsl:template name="termInfo">
|
---|
[4728] | 126 | <xsl:if test="count(termList/term) > 0">
|
---|
| 127 | <small>
|
---|
| 128 | <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.wordcount')"/>
|
---|
| 129 | <xsl:for-each select="termList/term">
|
---|
| 130 | <xsl:if test="position() > 1">, </xsl:if>
|
---|
| 131 | <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
|
---|
| 132 | </xsl:for-each>
|
---|
| 133 | </small>
|
---|
| 134 | <br/>
|
---|
| 135 | </xsl:if>
|
---|
| 136 | </xsl:template>
|
---|
| 137 |
|
---|
[4270] | 138 | </xsl:stylesheet>
|
---|
| 139 |
|
---|
| 140 |
|
---|