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/document.xsl

    r4146 r4253  
    2020  </xsl:template>
    2121
    22 <!-- this is hard coded for GATE, should somehow do it dynamically-->
     22  <!-- this is hard coded for GATE, should somehow do it dynamically-->
    2323  <xsl:template name="css-style">
    2424    <style type="text/css">
     
    3131    </style>
    3232  </xsl:template>
    33 
     33 
    3434  <xsl:template match="pageResponse">
    3535    <xsl:variable name="collName"><xsl:value-of select="ancestor::page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
    3636    <center>
    37     <xsl:call-template name="collectionPageBanner">
    38       <xsl:with-param name="collName" select="$collName"/>
     37      <xsl:call-template name="collectionPageBanner">
     38    <xsl:with-param name="collName" select="$collName"/>
    3939      </xsl:call-template>
    40 
     40     
     41      <!-- display the document -->
     42      <xsl:call-template name="display-document">
     43    <xsl:with-param name="collName" select="$collName"/>
     44      </xsl:call-template>
     45    </center>
     46   
     47    <xsl:call-template name="greenBar"/>
     48  </xsl:template>
     49   
     50  <xsl:template name="display-document">
     51    <xsl:param name="collName"/>
    4152    <!-- Display table of contents -->
    4253    <p/>
    4354    <table width="537" cellpadding="0" cellspacing="0">
    4455      <tr>
    45         <xsl:apply-templates select="document">
    46           <xsl:with-param name="collName" select="$collName"/>
    47         </xsl:apply-templates>
     56    <!--  modes are table-of-contents and  paged-naviagtion-->
     57    <!--<xsl:apply-templates select="document" mode='paged-navigation'>-->
     58    <xsl:apply-templates select="document" mode='table-of-contents'>
     59      <xsl:with-param name="collName" select="$collName"/>
     60    </xsl:apply-templates>
    4861      </tr>
    4962    </table>
    50    
     63   
    5164    <!-- Display document content -->
    5265    <xsl:apply-templates select="descendant::documentNode/nodeContent"/>
    53   </center>
    54   <xsl:call-template name="greenBar"/>
    55 </xsl:template>
    56 
    57 
    58 <xsl:template match="nodeContent">
    59   <p/>
    60   <table width="537" cellpadding="0" cellspacing="0">
    61     <tr>
    62       <td align="left">
    63     <xsl:for-each select="node()">
    64       <xsl:choose>
    65         <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
    66         <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
    67           </xsl:choose>
    68     </xsl:for-each>
    69       </td>
    70     </tr>
    71   </table>
    72 </xsl:template>
    73 
    74 
    75 <xsl:template match="annotation">
    76   <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span></xsl:template>
    77 
    78 
    79 <xsl:template match="document">
    80   <xsl:param name="collName"/>
     66  </xsl:template>
     67
     68  <!-- the actual text/content -->
     69  <xsl:template match="nodeContent">
     70    <p/>
     71    <table width="537" cellpadding="0" cellspacing="0">
     72      <tr>
     73    <td align="left">
     74      <xsl:for-each select="node()">
     75        <xsl:choose>
     76          <xsl:when test="not(name())"><xsl:value-of select="." disable-output-escaping="yes"/></xsl:when>
     77          <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
     78        </xsl:choose>
     79      </xsl:for-each>
     80    </td>
     81      </tr>
     82    </table>
     83  </xsl:template>
     84
     85
     86  <xsl:template match="annotation">
     87    <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span></xsl:template>
     88 
     89  <xsl:template match="document" mode="table-of-contents">
     90    <xsl:param name="collName"/>
    8191    <xsl:variable name="httpPath" select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
    8292    <xsl:variable name="assocfilepath" select="metadataList/metadata[@name='assocfilepath']"/>
    83   <!-- Display table of contents -->
    84   <td valign="top" align="left" width="200">
     93    <!-- Display cover image -->
     94    <td valign="top" align="left" width="200">
     95      <img><xsl:attribute name='src'><xsl:value-of select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg</xsl:attribute></img>
     96      <p />
     97      <!-- display the enrich service options here -->
     98      <xsl:apply-templates select="../serviceList">
     99    <xsl:with-param name="collName" select="$collName"/>
     100      </xsl:apply-templates>
     101
     102    </td>
     103    <!-- Display the hierarchical structure -->
     104    <td valign="top">
     105      <xsl:apply-templates select="documentNode[@nodeID]">
     106    <xsl:with-param name="collName" select="$collName"/>
     107    <xsl:with-param name="depth" select="0"/>
     108      </xsl:apply-templates>
     109    </td>
     110   
     111  </xsl:template>
     112
     113  <!-- paged naviagtion : INCOMPLETE!!-->
     114  <xsl:template match="document" mode="paged-navigation">
     115    <xsl:param name="collName"/>
     116    <xsl:variable name="library" select="ancestor::page/config/library_name"/>
     117    <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
     118    <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
     119    <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
     120    <td valign="left">
     121      <table>
     122    <xsl:choose>
     123      <xsl:when test="$pos=-1"><!-- a doc -->
     124        <tr valign="top">
     125          <td align="left">
     126          </td>
     127          <td align="center"><center>
     128          <b><xsl:value-of select="$children"/> pages.</b>
     129        </center></td>
     130          <td align="right">
     131        <a href="{$library}?a=d&amp;c={$collName}&amp;d={@selectedNode}.fc"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a>
     132          </td>
     133        </tr>
     134      </xsl:when>
     135     
     136      <xsl:otherwise> <!-- an internal node -->   
     137        <tr valign="top">
     138          <td align="left">
     139        <xsl:if test=" not ( $pos = 1 )">
     140          <a href="{$library}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ps"><img src="interfaces/nzdl/images/less.gif" border="0" align="absbottom" /></a>
     141        </xsl:if>
     142          </td>
     143          <td align="center"><center>
     144          <b>Page <xsl:value-of select="$pos"/> of <xsl:value-of select="$length"/>.</b>
     145        </center></td>
     146          <td align="right">
     147        <xsl:if test=" not($pos = $length)">
     148          <a href="{$library}?a=d&amp;c={$collName}&amp;d={@selectedNode}.ns"><img src="interfaces/nzdl/images/more.gif" border="0" align="absbottom" /></a>
     149        </xsl:if>
     150          </td>
     151        </tr>
     152      </xsl:otherwise>
     153    </xsl:choose>
     154    <tr valign="middle">
     155      <td align='center' valign='top' colspan='3'> goto form
     156      </td>
     157    </tr>
     158      </table>
     159    </td>
     160    <td valign="top" align="right" width="200">
    85161    <img><xsl:attribute name='src'><xsl:value-of select="ancestor::pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg</xsl:attribute></img>
    86162      <p />
     
    89165    <xsl:with-param name="collName" select="$collName"/>
    90166      </xsl:apply-templates>
    91 
    92   </td>
    93   <td valign="top">
     167     
     168    </td>
     169  </xsl:template>
     170 
     171
     172
     173  <xsl:template match="documentNode">
     174    <xsl:param name="collName"/>
     175    <xsl:param name="depth"/>
     176    <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
     177    <xsl:variable name="space" select="$depth * 25"/>
     178   
     179    <table>
     180      <tr valign="top">
     181    <td>
     182      <xsl:if test="not($depth = '0')">
     183        <img src="interfaces/default/images/space.gif" width="{$space}"/>
     184      </xsl:if>
     185    </td>
     186   
     187    <!-- Display the appropriate image, depending on the node type -->
     188    <td valign="top">
     189      <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="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if></xsl:attribute>
     190        <xsl:apply-templates select="." mode="displayNodeIcon"/>
     191      </a>
     192    </td>
     193   
     194    <!-- Display associated title, bolded if the node has content -->
     195    <td valign="top">
     196      <xsl:choose>
     197        <xsl:when test="nodeContent">
     198          <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>
     199        </xsl:when>
     200        <xsl:otherwise>
     201          <xsl:value-of select="metadataList/metadata[@name='Title']"/>
     202        </xsl:otherwise>
     203      </xsl:choose>
     204    </td>
     205      </tr>
     206    </table>
     207
     208   
     209    <!-- Apply recursively to the children of this node -->
    94210    <xsl:apply-templates select="documentNode[@nodeID]">
    95211      <xsl:with-param name="collName" select="$collName"/>
    96       <xsl:with-param name="depth" select="0"/>
     212      <xsl:with-param name="depth" select="$depth + 1"/>
    97213    </xsl:apply-templates>
    98   </td>
    99 </xsl:template>
    100 
    101 
    102 <xsl:template match="documentNode">
    103   <xsl:param name="collName"/>
    104   <xsl:param name="depth"/>
    105   <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
    106   <xsl:variable name="space" select="$depth * 25"/>
    107 
    108   <table>
    109     <tr valign="top">
    110       <td>
    111     <xsl:if test="not($depth = '0')">
    112           <img src="interfaces/default/images/space.gif" width="{$space}"/>
    113     </xsl:if>
    114       </td>
    115 
    116       <!-- Display the appropriate image, depending on the node type -->
    117       <td valign="top">
    118     <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="documentNode">.pr</xsl:if><xsl:if test="@nodeType='leaf'">&amp;sib=1</xsl:if></xsl:attribute>
    119       <xsl:apply-templates select="." mode="displayNodeIcon"/>
    120     </a>
    121       </td>
    122 
    123       <!-- Display associated title, bolded if the node has content -->
    124       <td valign="top">
    125         <xsl:choose>
    126       <xsl:when test="nodeContent">
    127         <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>
    128       </xsl:when>
    129       <xsl:otherwise>
    130         <xsl:value-of select="metadataList/metadata[@name='Title']"/>
    131       </xsl:otherwise>
    132     </xsl:choose>
    133       </td>
    134     </tr>
    135   </table>
    136 
    137   <!-- Apply recursively to the children of this node -->
    138   <xsl:apply-templates select="documentNode[@nodeID]">
    139     <xsl:with-param name="collName" select="$collName"/>
    140     <xsl:with-param name="depth" select="$depth + 1"/>
    141   </xsl:apply-templates>
    142 </xsl:template>
     214  </xsl:template>
     215 
     216
    143217
    144218  <xsl:template match="serviceList">
     
    156230    <xsl:if test='ancestor::page/pageRequest/paramList/param[@name="sib"]'>
    157231    <input type='hidden' name='sib'><xsl:attribute name='value'><xsl:value-of select='ancestor::page/pageRequest/paramList/param[@name="sib"]/@value'/></xsl:attribute></input></xsl:if>
    158     <input type='hidden' name='s' value='{@name}'/>
     232          <input type='hidden' name='s' value='{@name}'/>
    159233    <input type="submit"><xsl:attribute name="value"><xsl:value-of select='display/submit'/></xsl:attribute></input>
    160234      </form>
Note: See TracChangeset for help on using the changeset viewer.