source: trunk/gsdl3/interfaces/default/transform/basicquery.xsl@ 3752

Last change on this file since 3752 was 3752, checked in by mdewsnip, 21 years ago

Changed formatting of query results to be closer to GS2, added query results bar image, added query term word counts and overall document count.

  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5<xsl:include href="style.xsl"/>
6<xsl:include href="service-params.xsl"/>
7
8<xsl:output method="html"/>
9
10<xsl:template match="page">
11
12<xsl:variable name="collName">
13 <xsl:value-of select="request/paramList/param[@name='c']/@value"/>
14</xsl:variable>
15
16<html>
17<xsl:call-template name="greenstoneHead"/>
18<body xsl:use-attribute-sets="body-style">
19
20<table border="0" cellspacing="0" cellpadding="0" width="100%">
21<tr/><td valign="top" width="65"><img src="interfaces/default/images/spacer.gif" width="65" height="1" alt="" border="0"></img></td>
22<td/><center><table width="537"><tr/><td/>
23
24<center>
25<xsl:call-template name="collectionPageBanner">
26<xsl:with-param name="collName" select="$collName"/>
27</xsl:call-template>
28<xsl:apply-templates select="service">
29<xsl:with-param name="collName" select="$collName"/>
30</xsl:apply-templates>
31</center>
32<xsl:apply-templates select="response">
33<xsl:with-param name="collName" select="$collName"/>
34</xsl:apply-templates>
35<xsl:call-template name="greenBar"/>
36<xsl:call-template name="greenstoneFooter"/>
37
38</table></center>
39</table>
40</body>
41</html>
42</xsl:template>
43
44<xsl:template match="service">
45<xsl:param name="collName">coll-name</xsl:param>
46<xsl:variable name="subaction"><xsl:value-of select="../request/@subaction"/></xsl:variable>
47<xsl:variable name='library' select='ancestor::page/config/library_name'/>
48<h3><xsl:value-of select="display/name"/></h3><p/>
49<form name="QueryForm" method="get" action="/gsdl3/{$library}">
50<xsl:apply-templates select="paramList"/>
51<input type="hidden" name="a" value="q"/>
52<input type="hidden" name="sa" value="{$subaction}"/>
53<input type="hidden" name="rt" value="r"/>
54<input type="hidden" name="s" value="{@name}"/>
55<input type="hidden" name="c" value="{$collName}"/>
56<input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
57</form>
58</xsl:template>
59
60<xsl:template match="paramList">
61 <p/><table width="537">
62 <xsl:for-each select="param">
63 <xsl:choose>
64 <xsl:when test="@type='multi'">
65 <tr><td colspan='2'>
66 <xsl:apply-templates select='.'/></td></tr>
67 </xsl:when>
68 <xsl:otherwise>
69 <xsl:variable name="pname" select="@name"/>
70 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
71 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:for-each>
74 </table>
75</xsl:template>
76
77
78<!-- a param list that puts params in pairs- wont work as is with new
79param handling stuff -->
80<!--
81<xsl:template match="paramList">
82<p/><table width="537">
83<xsl:choose>
84<xsl:when test='count(param)>4'>
85<xsl:for-each select="param[position() mod 2 = 1]">
86<tr><xsl:apply-templates select="."/>
87<xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr>
88</xsl:for-each>
89</xsl:when>
90<xsl:otherwise>
91<xsl:for-each select="param">
92<tr><xsl:apply-templates select='.'/></tr>
93</xsl:for-each>
94</xsl:otherwise>
95</xsl:choose>
96</table>
97</xsl:template>
98-->
99
100
101<!-- Process the query response -->
102<xsl:template match="response">
103 <xsl:param name="collName">coll-name</xsl:param>
104 <xsl:call-template name="greenBarResults"/>
105
106 <!-- If query term information is available, display it -->
107 <br/>
108 <xsl:if test="count(content/metadataList/metadata[@type='term']) > 0">
109 <small>
110 Word count:
111 <xsl:for-each select="content/metadataList/metadata[@type='term']">
112 <xsl:if test="position() > 1">, </xsl:if>
113 <xsl:value-of select="@name"/>: <xsl:value-of select="@value"/>
114 </xsl:for-each>
115 </small><br/>
116 </xsl:if>
117
118 <!-- If the number of matching documents is known, display it -->
119 <xsl:variable name="numMatchingDocs" select="content/metadataList/metadata[@name='numMatchingDocs']"/>
120 <xsl:if test="$numMatchingDocs">
121 <xsl:choose>
122 <xsl:when test="$numMatchingDocs='0'">
123 No documents matched the query.
124 </xsl:when>
125 <xsl:when test="$numMatchingDocs='1'">
126 1 document matched the query.
127 </xsl:when>
128 <xsl:otherwise>
129 <xsl:value-of select="$numMatchingDocs"/> documents matched the query.
130 </xsl:otherwise>
131 </xsl:choose>
132 </xsl:if>
133
134 <!-- Display the matching documents -->
135 <table>
136 <tr valign="top">
137 <xsl:for-each select="content/documentList/document">
138 <tr>
139 <xsl:apply-templates select=".">
140 <xsl:with-param name="collName" select="$collName"/>
141 </xsl:apply-templates>
142 </tr>
143 </xsl:for-each>
144 </tr>
145 </table>
146</xsl:template>
147
148
149<xsl:template match="document">
150 <xsl:param name="collName">coll-name</xsl:param>
151 <xsl:variable name="library" select="ancestor::page/config/library_name"/>
152
153 <td><a href="{$library}?a=d&amp;c={$collName}&amp;d={@name}">link</a></td>
154 <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
155</xsl:template>
156
157
158<xsl:template name="greenBarResults">
159 <p/>
160 <center>
161 <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
162 </center>
163</xsl:template>
164
165</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.