Changeset 3752


Ignore:
Timestamp:
2003-02-21T11:36:50+13:00 (21 years ago)
Author:
mdewsnip
Message:

Changed formatting of query results to be closer to GS2, added query results bar image, added query term word counts and overall document count.

File:
1 edited

Legend:

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

    r3686 r3752  
    1010<xsl:template match="page">
    1111
    12 <xsl:variable name="collName"><xsl:value-of select="request/paramList/param[@name='c']/@value"/></xsl:variable>
     12<xsl:variable name="collName">
     13  <xsl:value-of select="request/paramList/param[@name='c']/@value"/>
     14</xsl:variable>
    1315
    1416<html>
    1517<xsl:call-template name="greenstoneHead"/>
    1618<body xsl:use-attribute-sets="body-style">
     19
     20<table border="0" cellspacing="0" cellpadding="0" width="100%">
     21<tr/><td valign="top" width="65"><img src="interfaces/default/images/spacer.gif" width="65" height="1" alt="" border="0"></img></td>
     22<td/><center><table width="537"><tr/><td/>
     23
    1724<center>
    1825<xsl:call-template name="collectionPageBanner">
     
    2229<xsl:with-param name="collName" select="$collName"/>
    2330</xsl:apply-templates>
     31</center>
    2432<xsl:apply-templates select="response">
    2533<xsl:with-param name="collName" select="$collName"/>
    2634</xsl:apply-templates>
    27 </center>
     35<xsl:call-template name="greenBar"/>
    2836<xsl:call-template name="greenstoneFooter"/>
     37
     38</table></center>
     39</table>
    2940</body>
    3041</html>
     
    4556<input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
    4657</form>
    47 <xsl:call-template name="greenBar"/>
    4858</xsl:template>
    4959
    5060<xsl:template match="paramList">
    51 <p/><table width="537">
    52 <xsl:for-each select="param">
    53 <xsl:choose>
    54 <xsl:when test="@type='multi'">
    55 <tr><td colspan='2'>
    56 <xsl:apply-templates select='.'/></td></tr>
    57 </xsl:when>
    58 <xsl:otherwise>
    59 <xsl:variable name="pname" select="@name"/>
    60 <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
    61 </xsl:otherwise>
    62 </xsl:choose>
    63 </xsl:for-each>
    64 </table>
     61  <p/><table width="537">
     62  <xsl:for-each select="param">
     63    <xsl:choose>
     64      <xsl:when test="@type='multi'">
     65        <tr><td colspan='2'>
     66        <xsl:apply-templates select='.'/></td></tr>
     67      </xsl:when>
     68      <xsl:otherwise>
     69        <xsl:variable name="pname" select="@name"/>
     70        <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
     71      </xsl:otherwise>
     72    </xsl:choose>
     73  </xsl:for-each>
     74  </table>
    6575</xsl:template>
    6676
     
    8898-->
    8999
     100
     101<!-- Process the query response -->
    90102<xsl:template match="response">
    91 <xsl:param name="collName">coll-name</xsl:param>
    92 <table width="537">
    93 <xsl:for-each select="content/documentList/document">
    94 <tr><xsl:apply-templates select="."><xsl:with-param name="collName" select="$collName"/></xsl:apply-templates></tr>
    95 </xsl:for-each>
    96 </table>
    97 <xsl:call-template name="greenBar"/>
     103  <xsl:param name="collName">coll-name</xsl:param>
     104  <xsl:call-template name="greenBarResults"/>
     105
     106  <!-- If query term information is available, display it -->
     107  <br/>
     108  <xsl:if test="count(content/metadataList/metadata[@type='term']) > 0">
     109    <small>
     110    Word count:
     111    <xsl:for-each select="content/metadataList/metadata[@type='term']">
     112      <xsl:if test="position() > 1">, </xsl:if>
     113      <xsl:value-of select="@name"/>: <xsl:value-of select="@value"/>
     114    </xsl:for-each>
     115    </small><br/>
     116  </xsl:if>
     117
     118  <!-- If the number of matching documents is known, display it -->
     119  <xsl:variable name="numMatchingDocs" select="content/metadataList/metadata[@name='numMatchingDocs']"/>
     120  <xsl:if test="$numMatchingDocs">
     121    <xsl:choose>
     122      <xsl:when test="$numMatchingDocs='0'">
     123        No documents matched the query.
     124      </xsl:when>
     125      <xsl:when test="$numMatchingDocs='1'">
     126        1 document matched the query.
     127      </xsl:when>
     128      <xsl:otherwise>
     129        <xsl:value-of select="$numMatchingDocs"/> documents matched the query.
     130      </xsl:otherwise>
     131    </xsl:choose>
     132  </xsl:if>
     133
     134  <!-- Display the matching documents -->
     135  <table>
     136  <tr valign="top">
     137  <xsl:for-each select="content/documentList/document">
     138    <tr>
     139    <xsl:apply-templates select=".">
     140      <xsl:with-param name="collName" select="$collName"/>
     141    </xsl:apply-templates>
     142    </tr>
     143  </xsl:for-each>
     144  </tr>
     145  </table>
    98146</xsl:template>
    99147
     148
    100149<xsl:template match="document">
    101 <xsl:param name="collName">coll-name</xsl:param>
    102 <xsl:variable name="library" select="ancestor::page/config/library_name"/>
    103 <td><a href="{$library}?a=d&amp;c={$collName}&amp;d={@name}">link</a></td><td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
     150  <xsl:param name="collName">coll-name</xsl:param>
     151  <xsl:variable name="library" select="ancestor::page/config/library_name"/>
     152
     153  <td><a href="{$library}?a=d&amp;c={$collName}&amp;d={@name}">link</a></td>
     154  <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
     155</xsl:template>
     156
     157
     158<xsl:template name="greenBarResults">
     159  <p/>
     160  <center>
     161  <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
     162  </center>
    104163</xsl:template>
    105164
    106165</xsl:stylesheet> 
    107 
    108 
    109 
    110 
    111 
Note: See TracChangeset for help on using the changeset viewer.