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

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

lots of changes for lots of stuff

  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 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
5 <xsl:include href="style.xsl"/>
6 <xsl:include href="service-params.xsl"/>
7 <xsl:include href="querytools.xsl"/>
8
9 <xsl:output method="html"/>
10
11 <xsl:template name="pageHead">
12 <head>
13 <title><xsl:call-template name="text"><xsl:with-param name="key">gsdl</xsl:with-param></xsl:call-template></title>
14 </head>
15 </xsl:template>
16
17 <xsl:template match="pageResponse">
18 <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
19 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
20 <center>
21 <xsl:call-template name="collectionPageBanner">
22 <xsl:with-param name="collName" select="$collName"/>
23 </xsl:call-template>
24 <xsl:apply-templates select="service">
25 <xsl:with-param name="collName" select="$collName"/>
26 </xsl:apply-templates>
27 </center>
28
29 <xsl:if test="documentNodeList">
30 <xsl:call-template name="query-response">
31 <xsl:with-param name="library" select="$library"/>
32 <xsl:with-param name="collName" select="$collName"/>
33 </xsl:call-template>
34 </xsl:if>
35 <xsl:call-template name="greenBar"/>
36 </xsl:template>
37
38 <xsl:template name="query-response">
39 <xsl:param name="library"/>
40 <xsl:param name="collName"/>
41 <xsl:call-template name="greenBarResults"/>
42
43 <!-- If query term information is available, display it -->
44 <br/>
45 <xsl:if test="count(termList/term) > 0">
46 <small>
47 <xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template>
48 <xsl:for-each select="termList/term">
49 <xsl:if test="position() > 1">, </xsl:if>
50 <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
51 </xsl:for-each>
52 </small>
53 <br/>
54 </xsl:if>
55
56 <!-- If the number of matching documents is known, display it -->
57 <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
58 <xsl:if test="$numDocsMatched">
59 <xsl:choose>
60 <xsl:when test="$numDocsMatched='0'">
61 <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
62 </xsl:when>
63 <xsl:when test="$numDocsMatched='1'">
64 <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
65 </xsl:when>
66 <xsl:otherwise>
67 <xsl:value-of select="$numDocsMatched"/> documents matched the query.
68 </xsl:otherwise>
69 </xsl:choose>
70 </xsl:if>
71
72 <!-- next and prev links at top of results-->
73 <xsl:call-template name="result-navigation"><xsl:with-param name="library" select="$library"/></xsl:call-template>
74 <!-- Display the matching documents -->
75 <xsl:variable name="hp"><xsl:choose><xsl:when test="ancestor::page/pageRequest/paramList/param[@name='hp']"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='hp']/@value"/></xsl:when><xsl:otherwise>20</xsl:otherwise></xsl:choose></xsl:variable>
76 <xsl:variable name="hn" select="ancestor::page/pageRequest/paramList/param[@name='hn']/@value"/>
77 <table>
78 <tr valign="top">
79 <xsl:for-each select="documentNodeList/documentNode">
80 <xsl:if test="position()&gt; (($hn - 1)*$hp) and position() &lt;= ($hn * $hp)">
81 <tr>
82 <xsl:apply-templates select=".">
83 <xsl:with-param name="collName" select="$collName"/>
84 </xsl:apply-templates>
85 </tr>
86 </xsl:if>
87 </xsl:for-each>
88 </tr>
89 </table>
90 <!-- next and prev links at bottom of page -->
91 <xsl:call-template name="result-navigation"><xsl:with-param name="library" select="$library"/></xsl:call-template>
92 </xsl:template>
93
94
95
96 <xsl:template match="service">
97 <xsl:param name="collName"/>
98 <xsl:variable name="subaction" select="../pageRequest/@subaction"/>
99 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
100 <h3><xsl:value-of select="display/name"/></h3><p/>
101 <form name="QueryForm" method="get" action="/gsdl3/{$library}">
102 <input type="hidden" name="a" value="q"/>
103 <input type="hidden" name="sa" value="{$subaction}"/>
104 <input type="hidden" name="rt" value="r"/>
105 <input type="hidden" name="s" value="{@name}"/>
106 <input type="hidden" name="c" value="{$collName}"/>
107 <input type="hidden" name="hn" value="1"/>
108 <xsl:apply-templates select="paramList"/>
109 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
110 </form>
111 </xsl:template>
112
113
114 <xsl:template match="paramList">
115 <p/><table width="537">
116 <xsl:for-each select="param">
117 <xsl:choose>
118 <xsl:when test="@type='multi'">
119 <tr><td colspan='2'>
120 <xsl:apply-templates select='.'/></td></tr>
121 </xsl:when>
122 <xsl:otherwise>
123 <xsl:variable name="pname" select="@name"/>
124 <xsl:variable name="pvalue"><xsl:choose><xsl:when test="ancestor::page/pageRequest/paramList/param[@name=$pname]"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name=$pname]/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="@default"/></xsl:otherwise></xsl:choose></xsl:variable>
125 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."><xsl:with-param name="default" select="$pvalue"/></xsl:apply-templates></td></tr>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:for-each>
129 </table>
130 </xsl:template>
131
132
133 <!-- a param list that puts params in pairs- wont work as is with new
134 param handling stuff -->
135 <!--
136 <xsl:template match="paramList">
137 <p/><table width="537">
138 <xsl:choose>
139 <xsl:when test='count(param)>4'>
140 <xsl:for-each select="param[position() mod 2 = 1]">
141 <tr><xsl:apply-templates select="."/>
142 <xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr>
143</xsl:for-each>
144</xsl:when>
145 <xsl:otherwise>
146 <xsl:for-each select="param">
147 <tr><xsl:apply-templates select='.'/></tr>
148</xsl:for-each>
149</xsl:otherwise>
150</xsl:choose>
151</table>
152</xsl:template>
153 -->
154
155 <!-- the default doc node template for the query results -->
156 <!-- eventually shouldn't need sib arg here -->
157 <xsl:template match="documentNode">
158 <xsl:param name="collName"/>
159 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
160
161 <td>
162 <a><xsl:attribute name="href"><xsl:value-of select='$library'/>?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></xsl:attribute>
163 <xsl:apply-templates select="." mode="displayNodeIcon"/>
164 </a>
165 </td>
166 <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
167 </xsl:template>
168
169
170 <xsl:template name="greenBarResults">
171 <p/>
172 <center>
173 <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
174 </center>
175 </xsl:template>
176
177</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.