source: trunk/gsdl3/interfaces/default/transform/document.xsl@ 3790

Last change on this file since 3790 was 3789, checked in by mdewsnip, 21 years ago

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

  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<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">
6
7<xsl:include href="style.xsl"/>
8<xsl:output method="html"/>
9<!--
10<xsl:output method="xml"/>
11-->
12
13
14<xsl:template match="page">
15 <xsl:variable name="collName" select="request/paramList/param[@name='c']/@value"/>
16
17 <html>
18 <xsl:call-template name="greenstoneHead"/>
19 <!-- <head>
20 <title>
21 No title yet.
22 </title>
23 </head> -->
24
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>
55</xsl:template>
56
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>
71</xsl:template>
72
73
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"/>
79
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 TracBrowser for help on using the repository browser.