Index: trunk/gsdl3/web/interfaces/nzdl/transform/basicquery.xsl
===================================================================
--- trunk/gsdl3/web/interfaces/nzdl/transform/basicquery.xsl	(revision 4253)
+++ trunk/gsdl3/web/interfaces/nzdl/transform/basicquery.xsl	(revision 4254)
@@ -1,11 +1,12 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet version="1.0"
-xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
-<xsl:include href="style.xsl"/>
-<xsl:include href="service-params.xsl"/>
-
-<xsl:output method="html"/>
-
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  
+  <xsl:include href="style.xsl"/>
+  <xsl:include href="service-params.xsl"/>
+  <xsl:include href="querytools.xsl"/>
+  
+  <xsl:output method="html"/>
+  
   <xsl:template name="pageHead">
     <head>
@@ -17,4 +18,5 @@
   <xsl:template match="pageResponse">
     <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
+    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
 
     <center>
@@ -28,41 +30,54 @@
     </center>
 
-    <!-- Process the query response -->    
     <xsl:if test="documentNodeList">
-      <xsl:call-template name="greenBarResults"/>
+      <xsl:call-template name="query-response">
+	<xsl:with-param name="library" select="$library"/>
+	<xsl:with-param name="collName" select="$collName"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:call-template name="greenBar"/>
+  </xsl:template>
+  
+  <xsl:template name="query-response">
+    <xsl:param name="library"/>
+    <xsl:param name="collName"/>
+    <xsl:call-template name="greenBarResults"/>
 
-      <!-- If query term information is available, display it -->
+    <!-- If query term information is available, display it -->
+    <br/>
+    <xsl:if test="count(termList/term) > 0">
+      <small>
+	<xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template> 
+	<xsl:for-each select="termList/term">
+	  <xsl:if test="position() > 1">, </xsl:if>
+	  <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/> 
+	</xsl:for-each>
+      </small>
       <br/>
-      <xsl:if test="count(termList/term) > 0">
-	<small>
-	  <xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template> 
-	  <xsl:for-each select="termList/term">
-	    <xsl:if test="position() > 1">, </xsl:if>
-	    <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/> 
-	  </xsl:for-each>
-	</small>
-	<br/>
-      </xsl:if>
-      
-      <!-- If the number of matching documents is known, display it -->
-      <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
-      <xsl:if test="$numDocsMatched">
-	<xsl:choose>
-	  <xsl:when test="$numDocsMatched='0'">
-	    <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
-	  </xsl:when>
-	  <xsl:when test="$numDocsMatched='1'">
-	    <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <xsl:value-of select="$numDocsMatched"/> documents matched the query.
-	  </xsl:otherwise>
-	</xsl:choose>
-      </xsl:if>
-      
-      <!-- Display the matching documents -->
-      <table>
-	<tr valign="top">
-	  <xsl:for-each select="documentNodeList/documentNode">
+    </xsl:if>
+    
+    <!-- If the number of matching documents is known, display it -->
+    <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
+    <xsl:if test="$numDocsMatched">
+      <xsl:choose>
+	<xsl:when test="$numDocsMatched='0'">
+	  <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
+	</xsl:when>
+	<xsl:when test="$numDocsMatched='1'">
+	  <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise>
+	  <xsl:value-of select="$numDocsMatched"/> documents matched the query.
+	</xsl:otherwise>
+      </xsl:choose>
+    </xsl:if>
+    
+    <!-- Display the matching documents -->
+    <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>
+    <xsl:variable name="hn" select="ancestor::page/pageRequest/paramList/param[@name='hn']/@value"/>      
+    <table>
+      <tr valign="top">
+	<xsl:for-each select="documentNodeList/documentNode">
+	  <xsl:if test="position()&gt; (($hn - 1)*$hp) and position() &lt;= ($hn * $hp)">
 	    <tr>
 	      <xsl:apply-templates select=".">
@@ -70,89 +85,64 @@
 	      </xsl:apply-templates>
 	    </tr>
-	  </xsl:for-each>
-	</tr>
-      </table>
-    </xsl:if>
-    <xsl:call-template name="greenBar"/>
+	  </xsl:if>
+	</xsl:for-each>
+      </tr>
+    </table>
+    <!-- next and prev links at bottom of page -->
+    <xsl:call-template name="result-navigation"><xsl:with-param name="library" select="$library"/></xsl:call-template>
   </xsl:template>
 
 
-<xsl:template match="service">
-<xsl:param name="collName">coll-name</xsl:param>
-<xsl:variable name="subaction"><xsl:value-of select="../request/@subaction"/></xsl:variable>
-<xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
-<h3><xsl:value-of select="display/name"/></h3><p/>
-<form name="QueryForm" method="get" action="/gsdl3/{$library}">
-<xsl:apply-templates select="paramList"/>
-<input type="hidden" name="a" value="q"/>
-<input type="hidden" name="sa" value="{$subaction}"/>
-<input type="hidden" name="rt" value="r"/>
-<input type="hidden" name="s" value="{@name}"/>
-<input type="hidden" name="c" value="{$collName}"/>
-<input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
-</form>
-</xsl:template>
-
-
-<xsl:template match="paramList">
-  <p/><table width="537">
-  <xsl:for-each select="param">
-    <xsl:choose>
-      <xsl:when test="@type='multi'">
-        <tr><td colspan='2'>
-        <xsl:apply-templates select='.'/></td></tr>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:variable name="pname" select="@name"/>
-        <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:for-each>
-  </table>
-</xsl:template>
-
-
-<!-- a param list that puts params in pairs- wont work as is with new
-param handling stuff -->
-<!--
-<xsl:template match="paramList">
-<p/><table width="537">
-<xsl:choose>
-<xsl:when test='count(param)>4'>
-<xsl:for-each select="param[position() mod 2 = 1]"> 
-<tr><xsl:apply-templates select="."/>
-<xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr>
-</xsl:for-each>
-</xsl:when>
-<xsl:otherwise>
-<xsl:for-each select="param">
-<tr><xsl:apply-templates select='.'/></tr>
-</xsl:for-each>
-</xsl:otherwise>
-</xsl:choose>
-</table>
-</xsl:template>
--->
-
-
-<xsl:template match="documentNode">
-  <xsl:param name="collName"/>
-  <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
-
-  <td>
-  <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>
-  <xsl:apply-templates select="." mode="displayNodeIcon"/>
-  </a>
-  </td>
-  <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
-</xsl:template>
-
-
-<xsl:template name="greenBarResults">
-  <p/>
-  <center>
-  <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
-  </center>
-</xsl:template>
-
+  <xsl:template match="service">
+    <xsl:param name="collName"/>
+    <xsl:variable name="subaction" select="../pageRequest/@subaction"/>
+    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
+    <form name="QueryForm" method="get" action="/gsdl3/{$library}">
+      <input type="hidden" name="a" value="q"/>
+      <input type="hidden" name="sa" value="{$subaction}"/>
+      <input type="hidden" name="rt" value="r"/>
+      <input type="hidden" name="s" value="{@name}"/>
+      <input type="hidden" name="c" value="{$collName}"/>
+      <input type="hidden" name="hn" value="1"/>
+      <xsl:apply-templates select="paramList"/>
+    </form>
+  </xsl:template>
+  
+  <!-- a special handling of the param list -->
+  <xsl:template match="paramList">
+    <table>
+      <tr><td>
+	  Search for <xsl:apply-templates select="param[@name='index']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='index']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates><xsl:if test="param[@name='level']">at <xsl:apply-templates select="param[@name='level']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='level']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates> level</xsl:if> which contain <xsl:apply-templates select="param[@name='matchMode']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='matchMode']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates> of the words
+	</td></tr>
+      <tr><td>
+	  <nobr><xsl:apply-templates select="param[@name='query']"><xsl:with-param name="default"><xsl:apply-templates select="param[@name='query']" mode="calculate-default"/></xsl:with-param></xsl:apply-templates><input type="submit"><xsl:attribute name="value"><xsl:value-of select='../display/submit'/></xsl:attribute></input></nobr>
+	</td></tr>
+    </table>
+  </xsl:template>
+  
+  <xsl:template match="param" mode="calculate-default">
+    <xsl:variable name="pname" select="@name"/>
+    <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:template>
+  
+  <xsl:template match="documentNode">
+    <xsl:param name="collName"/>
+    <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
+    
+    <td>
+      <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>
+	<xsl:apply-templates select="." mode="displayNodeIcon"/>
+      </a>
+    </td>
+    <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
+  </xsl:template>
+  
+  
+  <xsl:template name="greenBarResults">
+    <p/>
+    <center>
+      <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
+    </center>
+  </xsl:template>
+  
 </xsl:stylesheet>  
Index: trunk/gsdl3/web/interfaces/nzdl/transform/classifier.xsl
===================================================================
--- trunk/gsdl3/web/interfaces/nzdl/transform/classifier.xsl	(revision 4253)
+++ trunk/gsdl3/web/interfaces/nzdl/transform/classifier.xsl	(revision 4254)
@@ -42,6 +42,5 @@
     <xsl:variable name="orientation"><xsl:value-of select="ancestor::page/pageResponse/service/classifierList/classifier[@name=$cl_name]/@orientation"/></xsl:variable>
     <xsl:variable name='mode'><xsl:value-of select='$orientation'/>-<xsl:value-of select='$interleave'/></xsl:variable>
-    <!--<xsl:apply-templates select="." mode='{$mode}'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='serviceName' select='$serviceName'/></xsl:apply-templates> -->
-
+    <!-- cant seem to do this any other way, ie mode='{$mode}' doesn't work -->
     <xsl:choose>
       <xsl:when test="$mode='horizontal-true'">
@@ -62,6 +61,6 @@
   <!-- vertical and interleave = true: process all document and classifier children together, recursively -->
   <xsl:template match="classifier" mode="vertical-true">
-    <xsl:param name="collName">coll-name</xsl:param>
-    <xsl:param name="serviceName">service-name</xsl:param>
+    <xsl:param name="collName"/>
+    <xsl:param name="serviceName"/>
     <table width='537'>
       <xsl:for-each select='classifierNode|documentNode'>
@@ -148,17 +147,5 @@
 <td><a href="{$library}?a=d&amp;c={$collName}&amp;d={@nodeID}"><img src='interfaces/default/images/book.gif' width='18' height='11' border='0'/></a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
 </xsl:template>
-<!--
-  <xslt:template xmlns:xslt="http://www.w3.org/1999/XSL/Transform" match="documentNode" priority="4">
-    <xslt:param name="collName">coll-name</xslt:param>
- 
-    <xslt:variable name="library" select="ancestor::page/pageExtra/config/library_name" />    <td>
-      <a href="{$library}?a=d&amp;c={$collName}&amp;d={@nodeID}">
-        <img border="0" height="11" src="interfaces/default/images/book.gif" width="18" /></a>
-    </td>
- 
-    <td>
-      <xslt:value-of select="metadataList/metadata[@name='Source']" /></td>
-  </xslt:template>
--->
+  
   <!-- icon + title -->
   <xsl:template match="classifierNode">
@@ -166,5 +153,5 @@
     <xsl:param name="serviceName">service-name</xsl:param>
     <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
-    <td><a><xsl:attribute name='href'><xsl:value-of select='$library'/>?a=b&amp;s=<xsl:value-of select='$serviceName'/>&amp;c=<xsl:value-of select='$collName'/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if><xsl:if test="parent::node()[@orientation='horizontal']">&amp;sib=1</xsl:if></xsl:attribute><img src='interfaces/default/images/bshelf.gif' border='0' width='20' height='16' /></a></td><td align='left'><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
+    <td><a><xsl:attribute name='href'><xsl:value-of select='$library'/>?a=b&amp;rt=r&amp;s=<xsl:value-of select='$serviceName'/>&amp;c=<xsl:value-of select='$collName'/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if><xsl:if test="parent::node()[@orientation='horizontal']">&amp;sib=1</xsl:if></xsl:attribute><img src='interfaces/default/images/bshelf.gif' border='0' width='20' height='16' /></a></td><td align='left'><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
   </xsl:template>
   
Index: trunk/gsdl3/web/interfaces/nzdl/transform/pref.xsl
===================================================================
--- trunk/gsdl3/web/interfaces/nzdl/transform/pref.xsl	(revision 4253)
+++ trunk/gsdl3/web/interfaces/nzdl/transform/pref.xsl	(revision 4254)
@@ -17,4 +17,5 @@
 
   <xsl:template match="pageResponse">
+    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>    
     <xsl:variable name="collName" select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/>
     <center>
@@ -24,8 +25,57 @@
       </xsl:call-template>
 
-      <p />Preferences to go here
+      <form name="PrefForm" method="get" action="/gsdl3/{$library}">
+	<input type='hidden' name='a' value='p'/>
+	<input type='hidden' name='sa' value='pref'/>
+	<table>
+	  <tr><td><h3>Presentation preferences</h3></td></tr>
+	  <tr><td><xsl:call-template name="pres-prefs"/></td></tr>
+	  <tr><td><xsl:call-template name="greenBar"/></td></tr>
+	  <tr><td><h3>Search Preferences</h3></td></tr>
+	  <tr><td><xsl:call-template name="search-prefs"/></td></tr>
+	  <tr><td><xsl:call-template name="greenBar"/></td></tr>
+	</table>
+      </form>
     </center>
   </xsl:template>
 
+  
+  <xsl:template name="pres-prefs">
+    <table>
+      <tr><td>Interface language:</td><td align='left'>x</td></tr>
+      <tr><td>Encoding:</td><td align='left'>x</td></tr>
+      <tr><td>Interface format:</td><td align='left'>x</td></tr>
+    </table>
+  </xsl:template>
+  
+  <xsl:template name="search-prefs">
+    <table>
+      <tr><td></td><td align='right'><input type='submit' value='set prefs'/></td></tr>
+      <tr><td valign='baseline'>Query box size:</td><td><input type='radio' name='qb' value='0' onClick="updateqb(0);"><xsl:if test="ancestor::page/pageRequest/paramList/param[@name='qb']/@value=0"><xsl:attribute name="checked"></xsl:attribute></xsl:if></input> regular query box<br />
+	  <input type='radio' name='qb' value='1' onClick="updateqb(1);"><xsl:if test="ancestor::page/pageRequest/paramList/param[@name='qb']/@value=1"><xsl:attribute name="checked"></xsl:attribute></xsl:if></input>large query box</td></tr>
+      <tr><td valign='baseline'>Case differences:</td><td><input type='radio' name='ca' value='1' onClick="updateca(1);" checked=''/> ignore case differences<br />
+	  <input type='radio' name='ca' value='0' onClick="updateca(0);"/> upper/lower case must match</td></tr>
+      <tr><td valign='baseline'>Word endings:</td><td><input type='radio' name='st' value='1' onClick="updatest(1);"/> ignore word endings<br />
+	  <input type='radio' name='st' value='0' onClick="updatest(0);" checked=''/> whole word must match</td></tr>
+      <tr><td valign='baseline'>Query mode:</td><td><input type='radio' name='qm' value='0' onClick="updateqm(0);" checked=''/> simple query mode<br />
+	      <input type='radio' name='qm' value='1' onClick="updateqm(1);"/> advanced query mode (allows boolean searching using !, &amp;, |, and parentheses)</td></tr>
+      <tr><td colspan='2'>Return up to 
+	  <select name="md" onChange="updatemd();">
+	    <option value="50" selected="">50</option>
+	    <option value="100">100</option>
+	    <option value="200">200</option>
+	    <option value="-1">all</option>
+	  </select>
+	  hits with 
+	  <select name="hp" onChange="updatehp();">
+	    <option value="10">10 </option> 
+	    <option value="20" selected="">20</option>
+	    <option value="50">50</option>
+	    <option value="-1">all</option>
+	  </select>
+	  hits per page.
+	</td></tr>
+    </table>
+  </xsl:template>
 
 </xsl:stylesheet>
Index: trunk/gsdl3/web/interfaces/nzdl/transform/style.xsl
===================================================================
--- trunk/gsdl3/web/interfaces/nzdl/transform/style.xsl	(revision 4253)
+++ trunk/gsdl3/web/interfaces/nzdl/transform/style.xsl	(revision 4254)
@@ -119,5 +119,5 @@
   <xsl:template name="navigationBar">
     <xsl:param name="collName"/>
-    <xsl:variable name="classifiers" select="ancestor::page/pageExtra/service[@name='ClassifierBrowse']/classifierList"/>
+    <xsl:variable name="classifiers" select="ancestor::page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList"/>
     <xsl:variable name="action" select="ancestor::page/pageRequest/@action"/>
     <xsl:variable name="classifier" select="ancestor::page/pageRequest/paramList/param[@name='cl']/@value"/>
@@ -129,5 +129,5 @@
       <xsl:choose>
 	<xsl:when test="$action='q'">
-	  <img src="interfaces/nzdl/images/tsrchgr.gif" border='0'/>
+	  <img src="interfaces/nzdl/images/tSearchgr.gif" border='0'/>
 	</xsl:when>
 	<xsl:otherwise>
@@ -144,5 +144,5 @@
 	</xsl:apply-templates>
       </xsl:for-each>
-      <xsl:if test="ancestor::page/pageExtra/service[@name='PhindApplet']">
+      <xsl:if test="ancestor::page/pageResponse/collection/serviceList/service[@name='PhindApplet']">
 	<xsl:call-template name="nbPhrase">
 	  <xsl:with-param name="collName" select="$collName"/>
@@ -170,7 +170,5 @@
     <xsl:call-template name="navBarImage">
       <xsl:with-param name="url">nzdl?a=q&amp;rt=d&amp;s=TextQuery&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
-   <!--   <xsl:with-param name="off">tsrchof.gif</xsl:with-param>
-      <xsl:with-param name="on">tsrchon.gif</xsl:with-param>-->
-      <xsl:with-param name="name">srch</xsl:with-param>
+      <xsl:with-param name="name">Search</xsl:with-param>
       <xsl:with-param name="alt">Search</xsl:with-param>
     </xsl:call-template>
@@ -181,5 +179,5 @@
     <xsl:call-template name="navBarImage">
       <xsl:with-param name="url">nzdl?a=a&amp;rt=d&amp;s=PhindApplet&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
-      <xsl:with-param name="name">phrse</xsl:with-param>
+      <xsl:with-param name="name">Phrase</xsl:with-param>
       <xsl:with-param name="alt">Phrase Browse</xsl:with-param>
     </xsl:call-template>
@@ -196,5 +194,5 @@
       <xsl:otherwise>
 	<xsl:call-template name="navBarImage">
-	  <xsl:with-param name="url">nzdl?a=b&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="$collName"/>&amp;cl=<xsl:value-of select="@name"/></xsl:with-param>
+	  <xsl:with-param name="url">nzdl?a=b&amp;rt=r&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="$collName"/>&amp;cl=<xsl:value-of select="@name"/></xsl:with-param>
 	  <xsl:with-param name="name" select="$buttonname"/>
 	  <xsl:with-param name="alt">XXX</xsl:with-param>
