source: trunk/gsdl3/web/sites/localsite/collect/gberg/transform/document-toc.xsl@ 8538

Last change on this file since 8538 was 8538, checked in by kjdon, 19 years ago

fixed to work with the new pageHead and pageTitle templates

  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 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:gs3="http://www.greenstone.org/gs3"
5 xmlns:java="http://xml.apache.org/xslt/java"
6 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
7 extension-element-prefixes="java util"
8 exclude-result-prefixes="java util">
9
10 <!-- style includes global params interface_name, library_name -->
11 <xsl:include href="style.xsl"/>
12
13 <xsl:output method="html"/>
14
15 <xsl:template name="pageTitle">
16 <xsl:value-of select="/page/pageResponse/documentNode/metadataList/metadata[@name='root_Title']"/>: Table of Contents
17 </xsl:template>
18
19 <!-- page specific style goes here -->
20 <xsl:template name="pageStyle"/>
21
22
23 <xsl:template match="pageResponse">
24 <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
25 <xsl:call-template name="standardPageBanner">
26 <xsl:with-param name="collName" select="$collName"/>
27 </xsl:call-template>
28 <xsl:call-template name="navigationBar">
29 <xsl:with-param name="collName" select="$collName"/>
30 </xsl:call-template>
31 <!-- display the document -->
32 <xsl:apply-templates select="documentNode">
33 <xsl:with-param name="collName" select="$collName"/>
34 </xsl:apply-templates>
35 <xsl:call-template name="dividerBar"/>
36 </xsl:template>
37
38 <xsl:template match="documentNode">
39 <xsl:param name="collName"/>
40 <xsl:variable name="docname"><xsl:choose><xsl:when test="contains(@nodeID, '.')"><xsl:value-of select="substring-before(@nodeID, '.')"/></xsl:when><xsl:otherwise><xsl:value-of select="@nodeID"/></xsl:otherwise></xsl:choose></xsl:variable>
41 <h1>
42 <center>
43 <xsl:value-of select="metadataList/metadata[@name='root_Title']"/>
44 </center>
45 </h1>
46 <xsl:apply-templates select="nodeStructure/gutbook/book"><xsl:with-param name="collName" select="$collName"/><xsl:with-param name="docName" select="$docname"/></xsl:apply-templates>
47 </xsl:template>
48
49 <xsl:template match="book">
50 <xsl:param name="collName"/>
51 <xsl:param name="docName"/>
52 <h1>
53 Contents
54 </h1>
55 <ul class="toc">
56 <xsl:if test="acknowledge">
57 <li class='toc'>
58 <a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}.acknowledge&amp;c={$collName}">Acknowledgements</a>
59 </li>
60 </xsl:if>
61 <xsl:if test="frontmatter">
62 <li class='toc'>
63 <a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}.frontmatter&amp;c={$collName}">About this document</a>
64 </li>
65 </xsl:if>
66 <li class='toc'><a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}&amp;c={$collName}">Full version</a>
67 </li>
68 </ul>
69 <xsl:apply-templates select="bookbody"><xsl:with-param name="collName" select="$collName"/><xsl:with-param name="docName" select="$docName"/></xsl:apply-templates>
70 <xsl:if test="backmatter">
71 <ul class='toc'>
72 <li class='toc'>
73 <a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}.backmatter&amp;c={$collName}">Back matter (may include appendices, index, glossary etc)</a>
74 </li>
75 </ul>
76 </xsl:if>
77 </xsl:template>
78
79 <xsl:template match="bookbody">
80 <xsl:param name="collName"/>
81 <xsl:param name="docName"/>
82 <ul class="toc">
83 <xsl:apply-templates select="part|chapter">
84 <xsl:with-param name="collName" select="$collName"/>
85 <xsl:with-param name="docName" select="$docName"/>
86 </xsl:apply-templates>
87 </ul>
88 </xsl:template>
89
90 <xsl:template match="part">
91 <xsl:param name="collName"/>
92 <xsl:param name="docName"/>
93 <li class='toc'>
94 <a href="{$library_name}?a=xd&amp;sa=text&amp;c={$collName}&amp;d={$docName}.bookbody.part.{@gs3:id}">Part <xsl:value-of select="position()"/></a>
95 <xsl:if test="chapter">
96 <ul class='toc'>
97 <xsl:apply-templates select="chapter">
98 <xsl:with-param name="collName" select="$collName"/>
99 <xsl:with-param name="docName" select="$docName"/>
100 </xsl:apply-templates>
101 </ul>
102 </xsl:if>
103 </li>
104 </xsl:template>
105
106 <xsl:template match="chapter">
107 <xsl:param name="collName"/>
108 <xsl:param name="docName"/>
109 <li class='toc'>
110 <a href="{$library_name}?a=xd&amp;sa=text&amp;c={$collName}&amp;d={$docName}.bookbody.chapter.{@gs3:id}">
111 <xsl:choose>
112 <xsl:when test="title">
113 <xsl:value-of select="title"/>
114 </xsl:when>
115 <xsl:when test="chapheader">
116 <xsl:value-of select="chapheader/chapnum"/>: <xsl:value-of select="chapheader/title"/>
117 </xsl:when>
118 <xsl:otherwise>
119 Chapter <xsl:value-of select="position()"/>
120 </xsl:otherwise>
121 </xsl:choose>
122 </a>
123 </li>
124 </xsl:template>
125
126</xsl:stylesheet>
127
128
129
130
131
132
133
Note: See TracBrowser for help on using the repository browser.