source: trunk/gsdl3/web/interfaces/default/transform/querytools.xsl@ 4866

Last change on this file since 4866 was 4866, checked in by kjdon, 21 years ago

am working on the xslt, but thought I'd better commit what I've done. will check whether it works properly tomorrow :-)

  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 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 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <xsl:template name="resultNavigation">
10 <!-- <xsl:param name="library_name"/>-->
11 <xsl:variable name="hp"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hp']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hp']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
12 <xsl:if test="not($hp=-1)">
13 <xsl:variable name="hn"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hn']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hn']/@value"/></xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:variable>
14 <xsl:variable name="sa" select="/page/pageRequest/@subaction"/>
15 <xsl:variable name="prev" select="$hn - 1"/>
16 <xsl:variable name="next" select="$hn + 1"/>
17 <xsl:variable name="count" select="count(documentNodeList/documentNode)"/>
18 <p />
19 <center>
20 <table cellspacing='0' cellpadding='0' width='537'>
21 <tr>
22 <td align='left'>
23 <xsl:if test="$hn &gt; 1"><a href="{$library_name}?a=q&amp;rt=r&amp;hn={$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)*$hp + 1)"/> - <xsl:value-of select="number(($prev * $hp))"/></a></xsl:if>
24 </td>
25 <td align='right'>
26 <xsl:if test="(($hn * $hp) + 1) &lt; $count">
27 <xsl:variable name='m' select="number($next * $hp)"/>
28 <xsl:variable name='mm'><xsl:choose><xsl:when test="$m &lt; $count"><xsl:value-of select='$m'/></xsl:when><xsl:otherwise><xsl:value-of select='$count'/></xsl:otherwise></xsl:choose></xsl:variable>
29 <a href="{$library_name}?a=q&amp;sa={$sa}&amp;rt=r&amp;hn={$next}"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.matches')"/><xsl:text> </xsl:text><xsl:value-of select="number(($next - 1)*$hp + 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>
30 </table>
31 </center>
32 </xsl:if>
33 </xsl:template>
34
35
36 <!-- the default doc node template for the query results -->
37 <!-- eventually shouldn't need sib arg here -->
38 <xsl:template match="documentNode">
39 <xsl:param name="collName"/>
40 <td>
41 <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?a=d&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if>&amp;dt=<xsl:value-of select='@documentType'/></xsl:attribute>
42 <xsl:apply-templates select="." mode="displayNodeIcon"/>
43 </a>
44 </td>
45 <td><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></td>
46 </xsl:template>
47
48 <xsl:template name="greenBarResults">
49 <p/>
50 <center>
51 <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
52 </center>
53 </xsl:template>
54
55 <xsl:template match="param" mode="calculate-default">
56 <xsl:variable name="pname" select="@name"/>
57 <xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name=$pname]"><xsl:value-of select="/page/pageRequest/paramList/param[@name=$pname]/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="@default"/></xsl:otherwise></xsl:choose>
58 </xsl:template>
59
60 <xsl:template name="termInfo">
61 <xsl:if test="count(termList/term) > 0">
62 <small>
63 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.wordcount')"/>
64 <xsl:for-each select="termList/term">
65 <xsl:if test="position() > 1">, </xsl:if>
66 <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
67 </xsl:for-each>
68 </small>
69 <br/>
70 </xsl:if>
71 </xsl:template>
72
73 <xsl:template name="matchDocs">
74 <!-- If the number of matching documents is known, display it -->
75 <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
76 <xsl:if test="$numDocsMatched">
77 <xsl:choose>
78 <xsl:when test="$numDocsMatched='0'">
79 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch')"/>
80 </xsl:when>
81 <xsl:when test="$numDocsMatched='1'">
82 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch')"/>
83 </xsl:when>
84 <xsl:otherwise>
85 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', $numDocsMatched)"/>
86 </xsl:otherwise>
87 </xsl:choose>
88 </xsl:if>
89 </xsl:template>
90
91 <xsl:template name="resultList">
92 <xsl:param name="collName"/>
93 <xsl:variable name="hp"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='hp']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='hp']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
94 <xsl:variable name="hn" select="/page/pageRequest/paramList/param[@name='hn']/@value"/>
95 <table>
96 <tr valign="top">
97 <xsl:for-each select="documentNodeList/documentNode">
98 <xsl:if test="$hp=-1 or (position()&gt; (($hn - 1)*$hp) and position() &lt;= ($hn * $hp))">
99 <tr>
100 <xsl:apply-templates select=".">
101 <xsl:with-param name="collName" select="$collName"/>
102 </xsl:apply-templates>
103 </tr>
104 </xsl:if>
105 </xsl:for-each>
106 </tr>
107 </table>
108 </xsl:template>
109
110</xsl:stylesheet>
111
112
Note: See TracBrowser for help on using the repository browser.