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