Changeset 3789


Ignore:
Timestamp:
2003-03-05T11:57:30+13:00 (21 years ago)
Author:
mdewsnip
Message:

Extensive revisions to show the table of contents in GS2 style, and display document content.

File:
1 edited

Legend:

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

    r3653 r3789  
    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 xmlns:java="http://xml.apache.org/xslt/java"
    5 extension-element-prefixes="java">
     3        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     4        xmlns:java="http://xml.apache.org/xslt/java"
     5        extension-element-prefixes="java">
    66
    77<xsl:include href="style.xsl"/>
    88<xsl:output method="html"/>
    99<!--
    10 <xsl:output method="xml"/> 
     10<xsl:output method="xml"/>
    1111-->
     12
     13
    1214<xsl:template match="page">
     15  <xsl:variable name="collName" select="request/paramList/param[@name='c']/@value"/>
    1316
    14 <xsl:variable name="collName"><xsl:value-of select="request/paramList/param[@name='c']/@value"/></xsl:variable>
     17  <html>
     18    <xsl:call-template name="greenstoneHead"/>
     19    <!-- <head>
     20      <title>
     21    No title yet.
     22      </title>
     23    </head> -->
    1524
    16 <html>
    17 <xsl:call-template name="greenstoneHead"/>
    18 <body xsl:use-attribute-sets="body-style">
    19 <center>
    20 <xsl:call-template name="collectionPageBanner">
    21 <xsl:with-param name="collName" select="$collName"/>
    22 </xsl:call-template>
    23 <xsl:apply-templates select="response"/>
    24 </center>
    25 <xsl:call-template name="greenstoneFooter"/>
    26 </body>
    27 </html>
     25    <body xsl:use-attribute-sets="body-style">
     26      <center>
     27        <xsl:call-template name="collectionPageBanner">
     28          <xsl:with-param name="collName" select="$collName"/>
     29        </xsl:call-template>
     30
     31    <!-- Display table of contents -->
     32    <p/>
     33        <table width="537" cellpadding="0" cellspacing="0">
     34          <tr>
     35            <xsl:apply-templates select="response/content/document">
     36              <xsl:with-param name="collName" select="$collName"/>
     37            </xsl:apply-templates>
     38          </tr>
     39        </table>
     40
     41    <!-- Display document content -->
     42        <p/>
     43        <table width="537" cellpadding="0" cellspacing="0">
     44          <tr>
     45        <td align="left">
     46          <xsl:value-of disable-output-escaping="yes" select="descendant::documentNode/content"/>
     47        </td>
     48      </tr>
     49        </table>
     50      </center>
     51
     52      <xsl:call-template name="greenstoneFooter"/>
     53    </body>
     54  </html>
    2855</xsl:template>
    2956
    30 <xsl:template match="response">
    31 <table width="537"><tr><td>
    32 <xsl:value-of disable-output-escaping="yes" select="content/document"/>
    33 </td></tr></table>
    34 <xsl:call-template name="greenBar"/>
     57
     58<xsl:template match="document">
     59  <xsl:param name="collName">coll-name</xsl:param>
     60
     61  <!-- Display table of contents -->
     62  <td valign="top" align="left" width="200">
     63    <img src="interfaces/default/images/cover.jpg"/> <!-- TO DO -->
     64  </td>
     65  <td valign="top">
     66    <xsl:apply-templates select="documentNode[@documentID]">
     67      <xsl:with-param name="collName" select="$collName"/>
     68      <xsl:with-param name="depth" select="0"/>
     69    </xsl:apply-templates>
     70  </td>
    3571</xsl:template>
    36 </xsl:stylesheet> 
    3772
    3873
     74<xsl:template match="documentNode">
     75  <xsl:param name="collName">coll-name</xsl:param>
     76  <xsl:param name="depth"/>
     77  <xsl:variable name="library" select="ancestor::page/config/library_name"/>
     78  <xsl:variable name="space" select="$depth * 25"/>
    3979
     80  <table>
     81    <tr valign="top">
     82      <td>
     83    <xsl:if test="not($depth = '0')">
     84          <img src="interfaces/default/images/space.gif" width="{$space}"/>
     85    </xsl:if>
     86      </td>
     87
     88      <!-- Display the appropriate image, depending on the node type -->
     89      <td valign="top">
     90    <a href="{$library}?a=d&amp;c={$collName}&amp;d={@documentID}">
     91      <xsl:if test="@documentNodeType='root'">
     92        <img border="0" width="28" height="23"
     93         src="interfaces/default/images/openbook.gif"
     94             alt="Close this book"/>
     95      </xsl:if>
     96      <xsl:if test="@documentNodeType='interior'">
     97        <xsl:choose>
     98          <xsl:when test="documentNode">
     99            <img border="0" width="23" height="15"
     100             src="interfaces/default/images/openfldr.gif"
     101             alt="Close this folder"/>
     102          </xsl:when>
     103          <xsl:otherwise>
     104            <img border="0" width="23" height="15"
     105             src="interfaces/default/images/clsdfldr.gif"
     106             alt="Open this folder and view contents"/>
     107          </xsl:otherwise>
     108        </xsl:choose>
     109      </xsl:if>
     110      <xsl:if test="@documentNodeType='leaf'">
     111        <img border="0" width="16" height="21"
     112             src="interfaces/default/images/itext.gif"
     113             alt="View the document"/>
     114      </xsl:if>
     115    </a>
     116      </td>
     117
     118      <!-- Display associated title, bolded if the node is selected -->
     119      <td valign="top">
     120        <xsl:choose>
     121      <xsl:when test="content">
     122        <b><xsl:value-of select="metadataList/metadata[@name='Title']"/></b>
     123      </xsl:when>
     124      <xsl:otherwise>
     125        <xsl:value-of select="metadataList/metadata[@name='Title']"/>
     126      </xsl:otherwise>
     127    </xsl:choose>
     128      </td>
     129    </tr>
     130  </table>
     131
     132  <!-- Apply recursively to the children of this node -->
     133  <xsl:apply-templates select="documentNode[@documentID]">
     134    <xsl:with-param name="collName" select="$collName"/>
     135    <xsl:with-param name="depth" select="$depth + 1"/>
     136  </xsl:apply-templates>
     137</xsl:template>
     138
     139
     140</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.