Changeset 4729


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

moved a lot of teh smaller templates into querytools - so they can be reused by alternate interfaces. basicquery now does mainly the layout of the page, querytools has the tempaltes for the bits to go in it. paramlist handling also moved to service-params.xsl

File:
1 edited

Legend:

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

    r4716 r4729  
    4141  </xsl:template>
    4242
    43  
     43
     44  <!-- layout the response -->
    4445  <xsl:template name="query-response">
    4546    <xsl:param name="collName"/>
     
    4849    <!-- If query term information is available, display it -->
    4950    <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>
     51    <xsl:call-template name="termInfo"/>
     52    <xsl:call-template name="matchDocs"/>
    7653   
    7754    <!-- next and prev links at top of results-->
    78     <xsl:call-template name="result-navigation"/>
     55    <xsl:call-template name="resultNavigation"/>
    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"/>
     61    <xsl:call-template name="resultNavigation"/>
    9762  </xsl:template>
    98 
    99 
     63 
    10064
    10165  <xsl:template match="service">
     
    11478    </form>
    11579  </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&amp;c=<xsl:value-of select='$collName'/>&amp;d=<xsl:value-of select='@nodeID'/><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if>&amp;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  
     80   
    17981</xsl:stylesheet> 
Note: See TracChangeset for help on using the changeset viewer.