Ignore:
Timestamp:
2003-05-08T15:40:07+12:00 (21 years ago)
Author:
kjdon
Message:

lots of changes for lots of stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/web/interfaces/default/transform/basicquery.xsl

    r4146 r4253  
    11<?xml version="1.0" encoding="ISO-8859-1"?>
    22<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 
    8 <xsl:output method="html"/>
     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"/>
    910
    1011  <xsl:template name="pageHead">
    1112    <head>
    12       <title><xsl:call-template name="text"><xsl:with-param name="key">nzdl</xsl:with-param></xsl:call-template></title>
     13      <title><xsl:call-template name="text"><xsl:with-param name="key">gsdl</xsl:with-param></xsl:call-template></title>
    1314    </head>
    1415  </xsl:template>
     
    1617  <xsl:template match="pageResponse">
    1718    <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
    18 
     19    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
    1920    <center>
    2021      <xsl:call-template name="collectionPageBanner">
     
    2627    </center>
    2728
    28     <!-- Process the query response -->   
    2929    <xsl:if test="documentNodeList">
    30       <xsl:call-template name="greenBarResults"/>
    31 
    32       <!-- If query term information is available, display it -->
     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>
    3353      <br/>
    34       <xsl:if test="count(termList/term) > 0">
    35     <small>
    36       <xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template>
    37       <xsl:for-each select="termList/term">
    38         <xsl:if test="position() > 1">, </xsl:if>
    39         <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
    40       </xsl:for-each>
    41     </small>
    42     <br/>
    43       </xsl:if>
    44      
    45       <!-- If the number of matching documents is known, display it -->
    46       <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
    47       <xsl:if test="$numDocsMatched">
    48     <xsl:choose>
    49       <xsl:when test="$numDocsMatched='0'">
    50         <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
    51       </xsl:when>
    52       <xsl:when test="$numDocsMatched='1'">
    53         <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
    54       </xsl:when>
    55       <xsl:otherwise>
    56         <xsl:value-of select="$numDocsMatched"/> documents matched the query.
    57       </xsl:otherwise>
    58     </xsl:choose>
    59       </xsl:if>
    60      
    61       <!-- Display the matching documents -->
    62       <table>
    63     <tr valign="top">
    64       <xsl:for-each select="documentNodeList/documentNode">
     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)">
    6581        <tr>
    6682          <xsl:apply-templates select=".">
     
    6884          </xsl:apply-templates>
    6985        </tr>
    70       </xsl:for-each>
    71     </tr>
    72       </table>
    73     </xsl:if>
    74     <xsl:call-template name="greenBar"/>
     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>
    7592  </xsl:template>
    7693
    7794
    78 <xsl:template match="service">
    79 <xsl:param name="collName">coll-name</xsl:param>
    80 <xsl:variable name="subaction"><xsl:value-of select="../request/@subaction"/></xsl:variable>
    81 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
    82 <h3><xsl:value-of select="display/name"/></h3><p/>
    83 <form name="QueryForm" method="get" action="/gsdl3/{$library}">
    84 <xsl:apply-templates select="paramList"/>
    85 <input type="hidden" name="a" value="q"/>
    86 <input type="hidden" name="sa" value="{$subaction}"/>
    87 <input type="hidden" name="rt" value="r"/>
    88 <input type="hidden" name="s" value="{@name}"/>
    89 <input type="hidden" name="c" value="{$collName}"/>
    90 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
    91 </form>
    92 </xsl:template>
    9395
    94 
    95 <xsl:template match="paramList">
     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">
    96137  <p/><table width="537">
    97   <xsl:for-each select="param">
    98     <xsl:choose>
    99       <xsl:when test="@type='multi'">
    100         <tr><td colspan='2'>
    101         <xsl:apply-templates select='.'/></td></tr>
    102       </xsl:when>
    103       <xsl:otherwise>
    104         <xsl:variable name="pname" select="@name"/>
    105         <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
    106       </xsl:otherwise>
    107     </xsl:choose>
    108   </xsl:for-each>
    109   </table>
    110 </xsl:template>
    111 
    112 
    113 <!-- a param list that puts params in pairs- wont work as is with new
    114 param handling stuff -->
    115 <!--
    116 <xsl:template match="paramList">
    117 <p/><table width="537">
    118 <xsl:choose>
    119 <xsl:when test='count(param)>4'>
    120 <xsl:for-each select="param[position() mod 2 = 1]">
    121 <tr><xsl:apply-templates select="."/>
    122 <xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr>
     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>
    123143</xsl:for-each>
    124144</xsl:when>
    125 <xsl:otherwise>
    126 <xsl:for-each select="param">
    127 <tr><xsl:apply-templates select='.'/></tr>
     145  <xsl:otherwise>
     146  <xsl:for-each select="param">
     147  <tr><xsl:apply-templates select='.'/></tr>
    128148</xsl:for-each>
    129149</xsl:otherwise>
     
    131151</table>
    132152</xsl:template>
    133 -->
     153  -->
    134154
    135 
    136 <xsl:template match="documentNode">
    137   <xsl:param name="collName"/>
    138   <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
    139 
    140   <td>
    141   <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>
    142   <xsl:apply-templates select="." mode="displayNodeIcon"/>
    143   </a>
    144   </td>
    145   <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
    146 </xsl:template>
    147 
    148 
    149 <xsl:template name="greenBarResults">
    150   <p/>
    151   <center>
    152   <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
    153   </center>
    154 </xsl:template>
    155 
     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 
    156177</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.