Changeset 4733


Ignore:
Timestamp:
2003-06-18T15:59:38+12:00 (21 years ago)
Author:
kjdon
Message:

now uses a lot of templates from querytools - instead of repeating them all here. overwrites the handling of multi params so thet we can control the number of occurrances based on teh prefs

File:
1 edited

Legend:

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

    r4711 r4733  
    5050    <!-- If query term information is available, display it -->
    5151    <br/>
    52     <xsl:if test="count(termList/term) > 0">
    53       <small>
    54     <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.wordcount')"/>
    55     <xsl:for-each select="termList/term">
    56       <xsl:if test="position() > 1">, </xsl:if>
    57       <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
    58     </xsl:for-each>
    59       </small>
    60       <br/>
    61     </xsl:if>
    62    
     52    <xsl:call-template name="termInfo"/>   
    6353    <!-- If the number of matching documents is known, display it -->
    64     <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
    65     <xsl:if test="$numDocsMatched">
    66       <xsl:choose>
    67     <xsl:when test="$numDocsMatched='0'">
    68       <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.nodocsmatch')"/>
    69     </xsl:when>
    70     <xsl:when test="$numDocsMatched='1'">
    71       <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.onedocsmatch')"/>
    72     </xsl:when>
    73     <xsl:otherwise>
    74       <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.manydocsmatch', $numDocsMatched)"/>
    75     </xsl:otherwise>
    76       </xsl:choose>
    77     </xsl:if>
     54    <xsl:call-template name="matchDocs"/>
    7855   
    7956    <!-- 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()&gt; (($hn - 1)*$hp) and position() &lt;= ($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>
     57    <xsl:call-template name="resultList">
     58      <xsl:with-param name="collName" select="$collName"/>
     59    </xsl:call-template>
    9560    <!-- next and prev links at bottom of page -->
    96     <xsl:call-template name="result-navigation"><xsl:with-param name="library" select="$library_name"/></xsl:call-template>
     61    <xsl:call-template name="resultNavigation"/>
    9762  </xsl:template>
    9863
     
    11277  </xsl:template>
    11378 
    114   <!-- a special handling of the param list -->
    115   <xsl:template match="paramList">
     79  <!-- a special handling of the param list - we override the one in service-params -->
     80  <xsl:template match="paramList" priority='2'>
    11681    <table>
    11782      <tr><td>
     
    210175  </xsl:template>
    211176 
    212   <xsl:template match="param" mode="calculate-default">
    213     <xsl:variable name="pname" select="@name"/>
    214     <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>
    215   </xsl:template>
    216  
    217   <xsl:template match="documentNode">
    218     <xsl:param name="collName"/>
    219    
    220     <td>
    221       <a><xsl:attribute name="href"><xsl:value-of select='$library_name'/>?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>
    222     <xsl:apply-templates select="." mode="displayNodeIcon"/>
    223       </a>
    224     </td>
    225     <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
    226   </xsl:template>
    227  
    228  
    229   <xsl:template name="greenBarResults">
    230     <p/>
    231     <center>
    232       <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
    233     </center>
    234   </xsl:template>
    235  
     177  <!-- overwrite the multi param to use our value of occurs, not the one with the param -->
     178  <xsl:template match="param[@type='multi']" priority='2'>
     179    <xsl:variable name="parent" select="@name"/>
     180    <table>
     181      <tr>
     182    <xsl:for-each select="param">
     183      <xsl:variable name='pname' select='@name'/>
     184      <td><xsl:value-of select="ancestor::service/display/param[@name=$pname]/name"/></td>
     185    </xsl:for-each>
     186      </tr>
     187      <!-- the number of times to display this is the qfn variable -->
     188      <xsl:variable name="numbox"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='qfn']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='qfn']/@value"/></xsl:when><xsl:otherwise>4</xsl:otherwise></xsl:choose></xsl:variable>
     189      <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="$numbox"/><xsl:with-param name="pos" select="0"/></xsl:apply-templates>
     190    </table>
     191  </xsl:template>
     192
     193  <xsl:template match="param[@type='multi']" mode="contents">
     194    <xsl:param name="occurs"/>
     195    <xsl:param name="pos"/>
     196 <!--   <xsl:variable name="pos" select="@occurs - $occurs"/>-->
     197    <tr><xsl:for-each select="param">
     198    <xsl:variable name="pname" select="@name"/>
     199    <xsl:variable name="values" select="/page/pageRequest/paramList/param[@name=$pname]/@value"/>
     200    <td><xsl:choose>
     201        <xsl:when test="not(@ignore) or  @ignore != $pos">     
     202          <xsl:apply-templates select='.'><xsl:with-param name="default" select="java:org.greenstone.gsdl3.util.XSLTUtil.getNumberedItem($values, $pos)"/></xsl:apply-templates>
     203        </xsl:when>
     204        <xsl:otherwise><!-- put in a hidden placeholder -->
     205          <input type="hidden" name='{@shortname}' value=''/>
     206        </xsl:otherwise>
     207      </xsl:choose></td>
     208      </xsl:for-each></tr>
     209    <!-- recursively call this template to get multiple entries -->
     210    <xsl:if test="$pos &lt; ($occurs - 1)">
     211      <xsl:apply-templates select="." mode="contents"><xsl:with-param name="occurs" select="$occurs"/><xsl:with-param name="pos" select="$pos+1"/></xsl:apply-templates>
     212    </xsl:if>
     213  </xsl:template>
    236214</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.