Changeset 4254


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

work still in progress for nzdl

Location:
trunk/gsdl3/web/interfaces/nzdl/transform
Files:
4 edited

Legend:

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

    r4151 r4254  
    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"/>
    9 
     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"/>
     10 
    1011  <xsl:template name="pageHead">
    1112    <head>
     
    1718  <xsl:template match="pageResponse">
    1819    <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
     20    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
    1921
    2022    <center>
     
    2830    </center>
    2931
    30     <!-- Process the query response -->   
    3132    <xsl:if test="documentNodeList">
    32       <xsl:call-template name="greenBarResults"/>
     33      <xsl:call-template name="query-response">
     34    <xsl:with-param name="library" select="$library"/>
     35    <xsl:with-param name="collName" select="$collName"/>
     36      </xsl:call-template>
     37    </xsl:if>
     38    <xsl:call-template name="greenBar"/>
     39  </xsl:template>
     40 
     41  <xsl:template name="query-response">
     42    <xsl:param name="library"/>
     43    <xsl:param name="collName"/>
     44    <xsl:call-template name="greenBarResults"/>
    3345
    34       <!-- If query term information is available, display it -->
     46    <!-- If query term information is available, display it -->
     47    <br/>
     48    <xsl:if test="count(termList/term) > 0">
     49      <small>
     50    <xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template>
     51    <xsl:for-each select="termList/term">
     52      <xsl:if test="position() > 1">, </xsl:if>
     53      <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
     54    </xsl:for-each>
     55      </small>
    3556      <br/>
    36       <xsl:if test="count(termList/term) > 0">
    37     <small>
    38       <xsl:call-template name="text"><xsl:with-param name="key">query.wordcount</xsl:with-param></xsl:call-template>
    39       <xsl:for-each select="termList/term">
    40         <xsl:if test="position() > 1">, </xsl:if>
    41         <xsl:value-of select="@name"/>: <xsl:value-of select="@freq"/>
    42       </xsl:for-each>
    43     </small>
    44     <br/>
    45       </xsl:if>
    46      
    47       <!-- If the number of matching documents is known, display it -->
    48       <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
    49       <xsl:if test="$numDocsMatched">
    50     <xsl:choose>
    51       <xsl:when test="$numDocsMatched='0'">
    52         <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
    53       </xsl:when>
    54       <xsl:when test="$numDocsMatched='1'">
    55         <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
    56       </xsl:when>
    57       <xsl:otherwise>
    58         <xsl:value-of select="$numDocsMatched"/> documents matched the query.
    59       </xsl:otherwise>
    60     </xsl:choose>
    61       </xsl:if>
    62      
    63       <!-- Display the matching documents -->
    64       <table>
    65     <tr valign="top">
    66       <xsl:for-each select="documentNodeList/documentNode">
     57    </xsl:if>
     58   
     59    <!-- If the number of matching documents is known, display it -->
     60    <xsl:variable name="numDocsMatched" select="metadataList/metadata[@name='numDocsMatched']/@value"/>
     61    <xsl:if test="$numDocsMatched">
     62      <xsl:choose>
     63    <xsl:when test="$numDocsMatched='0'">
     64      <xsl:call-template name="text"><xsl:with-param name="key">query.nodocsmatch</xsl:with-param></xsl:call-template>
     65    </xsl:when>
     66    <xsl:when test="$numDocsMatched='1'">
     67      <xsl:call-template name="text"><xsl:with-param name="key">query.onedocsmatch</xsl:with-param></xsl:call-template>
     68    </xsl:when>
     69    <xsl:otherwise>
     70      <xsl:value-of select="$numDocsMatched"/> documents matched the query.
     71    </xsl:otherwise>
     72      </xsl:choose>
     73    </xsl:if>
     74   
     75    <!-- Display the matching documents -->
     76    <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>
     77    <xsl:variable name="hn" select="ancestor::page/pageRequest/paramList/param[@name='hn']/@value"/>     
     78    <table>
     79      <tr valign="top">
     80    <xsl:for-each select="documentNodeList/documentNode">
     81      <xsl:if test="position()&gt; (($hn - 1)*$hp) and position() &lt;= ($hn * $hp)">
    6782        <tr>
    6883          <xsl:apply-templates select=".">
     
    7085          </xsl:apply-templates>
    7186        </tr>
    72       </xsl:for-each>
    73     </tr>
    74       </table>
    75     </xsl:if>
    76     <xsl:call-template name="greenBar"/>
     87      </xsl:if>
     88    </xsl:for-each>
     89      </tr>
     90    </table>
     91    <!-- next and prev links at bottom of page -->
     92    <xsl:call-template name="result-navigation"><xsl:with-param name="library" select="$library"/></xsl:call-template>
    7793  </xsl:template>
    7894
    7995
    80 <xsl:template match="service">
    81 <xsl:param name="collName">coll-name</xsl:param>
    82 <xsl:variable name="subaction"><xsl:value-of select="../request/@subaction"/></xsl:variable>
    83 <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>
    84 <h3><xsl:value-of select="display/name"/></h3><p/>
    85 <form name="QueryForm" method="get" action="/gsdl3/{$library}">
    86 <xsl:apply-templates select="paramList"/>
    87 <input type="hidden" name="a" value="q"/>
    88 <input type="hidden" name="sa" value="{$subaction}"/>
    89 <input type="hidden" name="rt" value="r"/>
    90 <input type="hidden" name="s" value="{@name}"/>
    91 <input type="hidden" name="c" value="{$collName}"/>
    92 <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
    93 </form>
    94 </xsl:template>
    95 
    96 
    97 <xsl:template match="paramList">
    98   <p/><table width="537">
    99   <xsl:for-each select="param">
    100     <xsl:choose>
    101       <xsl:when test="@type='multi'">
    102         <tr><td colspan='2'>
    103         <xsl:apply-templates select='.'/></td></tr>
    104       </xsl:when>
    105       <xsl:otherwise>
    106         <xsl:variable name="pname" select="@name"/>
    107         <tr><td><xsl:value-of select='ancestor::service/display/param[@name=$pname]/name'/></td><td align="right"><xsl:apply-templates select="."/></td></tr>
    108       </xsl:otherwise>
    109     </xsl:choose>
    110   </xsl:for-each>
    111   </table>
    112 </xsl:template>
    113 
    114 
    115 <!-- a param list that puts params in pairs- wont work as is with new
    116 param handling stuff -->
    117 <!--
    118 <xsl:template match="paramList">
    119 <p/><table width="537">
    120 <xsl:choose>
    121 <xsl:when test='count(param)>4'>
    122 <xsl:for-each select="param[position() mod 2 = 1]">
    123 <tr><xsl:apply-templates select="."/>
    124 <xsl:if test="following-sibling::param[1]"><xsl:apply-templates select='following-sibling::param[1]'/></xsl:if></tr>
    125 </xsl:for-each>
    126 </xsl:when>
    127 <xsl:otherwise>
    128 <xsl:for-each select="param">
    129 <tr><xsl:apply-templates select='.'/></tr>
    130 </xsl:for-each>
    131 </xsl:otherwise>
    132 </xsl:choose>
    133 </table>
    134 </xsl:template>
    135 -->
    136 
    137 
    138 <xsl:template match="documentNode">
    139   <xsl:param name="collName"/>
    140   <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
    141 
    142   <td>
    143   <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>
    144   <xsl:apply-templates select="." mode="displayNodeIcon"/>
    145   </a>
    146   </td>
    147   <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
    148 </xsl:template>
    149 
    150 
    151 <xsl:template name="greenBarResults">
    152   <p/>
    153   <center>
    154   <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
    155   </center>
    156 </xsl:template>
    157 
     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    <form name="QueryForm" method="get" action="/gsdl3/{$library}">
     101      <input type="hidden" name="a" value="q"/>
     102      <input type="hidden" name="sa" value="{$subaction}"/>
     103      <input type="hidden" name="rt" value="r"/>
     104      <input type="hidden" name="s" value="{@name}"/>
     105      <input type="hidden" name="c" value="{$collName}"/>
     106      <input type="hidden" name="hn" value="1"/>
     107      <xsl:apply-templates select="paramList"/>
     108    </form>
     109  </xsl:template>
     110 
     111  <!-- a special handling of the param list -->
     112  <xsl:template match="paramList">
     113    <table>
     114      <tr><td>
     115      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
     116    </td></tr>
     117      <tr><td>
     118      <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>
     119    </td></tr>
     120    </table>
     121  </xsl:template>
     122 
     123  <xsl:template match="param" mode="calculate-default">
     124    <xsl:variable name="pname" select="@name"/>
     125    <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>
     126  </xsl:template>
     127 
     128  <xsl:template match="documentNode">
     129    <xsl:param name="collName"/>
     130    <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
     131   
     132    <td>
     133      <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>
     134    <xsl:apply-templates select="." mode="displayNodeIcon"/>
     135      </a>
     136    </td>
     137    <td><xsl:value-of select="metadataList/metadata[@name='Title']"/></td>
     138  </xsl:template>
     139 
     140 
     141  <xsl:template name="greenBarResults">
     142    <p/>
     143    <center>
     144      <img src="interfaces/default/images/qryresb.gif" width="537" height="17"/>
     145    </center>
     146  </xsl:template>
     147 
    158148</xsl:stylesheet> 
  • trunk/gsdl3/web/interfaces/nzdl/transform/classifier.xsl

    r4187 r4254  
    4242    <xsl:variable name="orientation"><xsl:value-of select="ancestor::page/pageResponse/service/classifierList/classifier[@name=$cl_name]/@orientation"/></xsl:variable>
    4343    <xsl:variable name='mode'><xsl:value-of select='$orientation'/>-<xsl:value-of select='$interleave'/></xsl:variable>
    44     <!--<xsl:apply-templates select="." mode='{$mode}'><xsl:with-param name='collName' select='$collName'/><xsl:with-param name='serviceName' select='$serviceName'/></xsl:apply-templates> -->
    45 
     44    <!-- cant seem to do this any other way, ie mode='{$mode}' doesn't work -->
    4645    <xsl:choose>
    4746      <xsl:when test="$mode='horizontal-true'">
     
    6261  <!-- vertical and interleave = true: process all document and classifier children together, recursively -->
    6362  <xsl:template match="classifier" mode="vertical-true">
    64     <xsl:param name="collName">coll-name</xsl:param>
    65     <xsl:param name="serviceName">service-name</xsl:param>
     63    <xsl:param name="collName"/>
     64    <xsl:param name="serviceName"/>
    6665    <table width='537'>
    6766      <xsl:for-each select='classifierNode|documentNode'>
     
    148147<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>
    149148</xsl:template>
    150 <!--
    151   <xslt:template xmlns:xslt="http://www.w3.org/1999/XSL/Transform" match="documentNode" priority="4">
    152     <xslt:param name="collName">coll-name</xslt:param>
    153  
    154     <xslt:variable name="library" select="ancestor::page/pageExtra/config/library_name" />    <td>
    155       <a href="{$library}?a=d&amp;c={$collName}&amp;d={@nodeID}">
    156         <img border="0" height="11" src="interfaces/default/images/book.gif" width="18" /></a>
    157     </td>
    158  
    159     <td>
    160       <xslt:value-of select="metadataList/metadata[@name='Source']" /></td>
    161   </xslt:template>
    162 -->
     149 
    163150  <!-- icon + title -->
    164151  <xsl:template match="classifierNode">
     
    166153    <xsl:param name="serviceName">service-name</xsl:param>
    167154    <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
    168     <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>
     155    <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>
    169156  </xsl:template>
    170157 
  • trunk/gsdl3/web/interfaces/nzdl/transform/pref.xsl

    r4151 r4254  
    1717
    1818  <xsl:template match="pageResponse">
     19    <xsl:variable name='library' select='ancestor::page/pageExtra/config/library_name'/>   
    1920    <xsl:variable name="collName" select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/>
    2021    <center>
     
    2425      </xsl:call-template>
    2526
    26       <p />Preferences to go here
     27      <form name="PrefForm" method="get" action="/gsdl3/{$library}">
     28    <input type='hidden' name='a' value='p'/>
     29    <input type='hidden' name='sa' value='pref'/>
     30    <table>
     31      <tr><td><h3>Presentation preferences</h3></td></tr>
     32      <tr><td><xsl:call-template name="pres-prefs"/></td></tr>
     33      <tr><td><xsl:call-template name="greenBar"/></td></tr>
     34      <tr><td><h3>Search Preferences</h3></td></tr>
     35      <tr><td><xsl:call-template name="search-prefs"/></td></tr>
     36      <tr><td><xsl:call-template name="greenBar"/></td></tr>
     37    </table>
     38      </form>
    2739    </center>
    2840  </xsl:template>
    2941
     42 
     43  <xsl:template name="pres-prefs">
     44    <table>
     45      <tr><td>Interface language:</td><td align='left'>x</td></tr>
     46      <tr><td>Encoding:</td><td align='left'>x</td></tr>
     47      <tr><td>Interface format:</td><td align='left'>x</td></tr>
     48    </table>
     49  </xsl:template>
     50 
     51  <xsl:template name="search-prefs">
     52    <table>
     53      <tr><td></td><td align='right'><input type='submit' value='set prefs'/></td></tr>
     54      <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 />
     55      <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>
     56      <tr><td valign='baseline'>Case differences:</td><td><input type='radio' name='ca' value='1' onClick="updateca(1);" checked=''/> ignore case differences<br />
     57      <input type='radio' name='ca' value='0' onClick="updateca(0);"/> upper/lower case must match</td></tr>
     58      <tr><td valign='baseline'>Word endings:</td><td><input type='radio' name='st' value='1' onClick="updatest(1);"/> ignore word endings<br />
     59      <input type='radio' name='st' value='0' onClick="updatest(0);" checked=''/> whole word must match</td></tr>
     60      <tr><td valign='baseline'>Query mode:</td><td><input type='radio' name='qm' value='0' onClick="updateqm(0);" checked=''/> simple query mode<br />
     61          <input type='radio' name='qm' value='1' onClick="updateqm(1);"/> advanced query mode (allows boolean searching using !, &amp;, |, and parentheses)</td></tr>
     62      <tr><td colspan='2'>Return up to
     63      <select name="md" onChange="updatemd();">
     64        <option value="50" selected="">50</option>
     65        <option value="100">100</option>
     66        <option value="200">200</option>
     67        <option value="-1">all</option>
     68      </select>
     69      hits with
     70      <select name="hp" onChange="updatehp();">
     71        <option value="10">10 </option>
     72        <option value="20" selected="">20</option>
     73        <option value="50">50</option>
     74        <option value="-1">all</option>
     75      </select>
     76      hits per page.
     77    </td></tr>
     78    </table>
     79  </xsl:template>
    3080
    3181</xsl:stylesheet>
  • trunk/gsdl3/web/interfaces/nzdl/transform/style.xsl

    r4186 r4254  
    119119  <xsl:template name="navigationBar">
    120120    <xsl:param name="collName"/>
    121     <xsl:variable name="classifiers" select="ancestor::page/pageExtra/service[@name='ClassifierBrowse']/classifierList"/>
     121    <xsl:variable name="classifiers" select="ancestor::page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList"/>
    122122    <xsl:variable name="action" select="ancestor::page/pageRequest/@action"/>
    123123    <xsl:variable name="classifier" select="ancestor::page/pageRequest/paramList/param[@name='cl']/@value"/>
     
    129129      <xsl:choose>
    130130    <xsl:when test="$action='q'">
    131       <img src="interfaces/nzdl/images/tsrchgr.gif" border='0'/>
     131      <img src="interfaces/nzdl/images/tSearchgr.gif" border='0'/>
    132132    </xsl:when>
    133133    <xsl:otherwise>
     
    144144    </xsl:apply-templates>
    145145      </xsl:for-each>
    146       <xsl:if test="ancestor::page/pageExtra/service[@name='PhindApplet']">
     146      <xsl:if test="ancestor::page/pageResponse/collection/serviceList/service[@name='PhindApplet']">
    147147    <xsl:call-template name="nbPhrase">
    148148      <xsl:with-param name="collName" select="$collName"/>
     
    170170    <xsl:call-template name="navBarImage">
    171171      <xsl:with-param name="url">nzdl?a=q&amp;rt=d&amp;s=TextQuery&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
    172    <!--   <xsl:with-param name="off">tsrchof.gif</xsl:with-param>
    173       <xsl:with-param name="on">tsrchon.gif</xsl:with-param>-->
    174       <xsl:with-param name="name">srch</xsl:with-param>
     172      <xsl:with-param name="name">Search</xsl:with-param>
    175173      <xsl:with-param name="alt">Search</xsl:with-param>
    176174    </xsl:call-template>
     
    181179    <xsl:call-template name="navBarImage">
    182180      <xsl:with-param name="url">nzdl?a=a&amp;rt=d&amp;s=PhindApplet&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
    183       <xsl:with-param name="name">phrse</xsl:with-param>
     181      <xsl:with-param name="name">Phrase</xsl:with-param>
    184182      <xsl:with-param name="alt">Phrase Browse</xsl:with-param>
    185183    </xsl:call-template>
     
    196194      <xsl:otherwise>
    197195    <xsl:call-template name="navBarImage">
    198       <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>
     196      <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>
    199197      <xsl:with-param name="name" select="$buttonname"/>
    200198      <xsl:with-param name="alt">XXX</xsl:with-param>
Note: See TracChangeset for help on using the changeset viewer.