source: main/trunk/greenstone3/web/sites/localsite/collect/gberg/transform/pages/document-toc.xsl@ 25487

Last change on this file since 25487 was 25487, checked in by kjdon, 12 years ago

versions of the document xsl files for use with oran interface, which expects them to be in pages subfolder

File size: 3.9 KB
RevLine 
[25487]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 xmlns:gslib="http://www.greenstone.org/skinning"
8 xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
9 extension-element-prefixes="java util"
10 exclude-result-prefixes="java util gsf">
11
12 <!-- use the 'main' layout -->
13 <xsl:import href="layouts/main.xsl"/>
14
15 <!-- set page title -->
16 <xsl:template name="pageTitle">
17 <xsl:value-of select="/page/pageResponse/documentNode/metadataList/metadata[@name='root_Title']"/>: Table of Contents
18 </xsl:template>
19
20 <!-- set page breadcrumbs -->
21 <xsl:template name="breadcrumbs">
22 <gslib:siteLink/><gslib:rightArrow/>
23 <gslib:collectionNameLinked/><gslib:rightArrow/>
24 </xsl:template>
25
26 <xsl:template match="/page"><xsl:apply-templates select="/page/pageResponse/documentNode"/></xsl:template>
27
28 <xsl:template match="/page/pageResponse/documentNode">
29 <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>
30 <h1>
31 <center>
32 <xsl:value-of select="metadataList/metadata[@name='root_Title']"/>
33 </center>
34 </h1>
35 <xsl:apply-templates select="nodeStructure/gutbook/book"><xsl:with-param name="docName" select="$docname"/></xsl:apply-templates>
36 </xsl:template>
37
38 <xsl:template match="book">
39 <xsl:param name="docName"/>
40 <h1>
41 Contents
42 </h1>
43 <ul class="toc">
44 <xsl:if test="acknowledge">
45 <li class='toc'>
46 <a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}.acknowledge&amp;c={$collName}">Acknowledgements</a>
47 </li>
48 </xsl:if>
49 <xsl:if test="frontmatter">
50 <li class='toc'>
51 <a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}.frontmatter&amp;c={$collName}">About this document</a>
52 </li>
53 </xsl:if>
54 <li class='toc'><a href="{$library_name}?a=xd&amp;sa=text&amp;d={$docName}&amp;c={$collName}">Full version</a>
55 </li>
56 </ul>
57 <xsl:apply-templates select="bookbody"><xsl:with-param name="docName" select="$docName"/></xsl:apply-templates>
58 <xsl:if test="backmatter">
59 <ul class='toc'>
60 <li class='toc'>
61 <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>
62 </li>
63 </ul>
64 </xsl:if>
65 </xsl:template>
66
67 <xsl:template match="bookbody">
68 <xsl:param name="docName"/>
69 <ul class="toc">
70 <xsl:apply-templates select="part|chapter">
71 <xsl:with-param name="docName" select="$docName"/>
72 </xsl:apply-templates>
73 </ul>
74 </xsl:template>
75
76 <xsl:template match="part">
77 <xsl:param name="docName"/>
78 <li class='toc'>
79 <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>
80 <xsl:if test="chapter">
81 <ul class='toc'>
82 <xsl:apply-templates select="chapter">
83 <xsl:with-param name="docName" select="$docName"/>
84 </xsl:apply-templates>
85 </ul>
86 </xsl:if>
87 </li>
88 </xsl:template>
89
90 <xsl:template match="chapter">
91 <xsl:param name="docName"/>
92 <li class='toc'>
93 <a href="{$library_name}?a=xd&amp;sa=text&amp;c={$collName}&amp;d={$docName}.bookbody.chapter.{@gs3:id}">
94 <xsl:choose>
95 <xsl:when test="title">
96 <xsl:value-of select="title"/>
97 </xsl:when>
98 <xsl:when test="chapheader">
99 <xsl:value-of select="chapheader/chapnum"/>: <xsl:value-of select="chapheader/title"/>
100 </xsl:when>
101 <xsl:otherwise>
102 Chapter <xsl:value-of select="position()"/>
103 </xsl:otherwise>
104 </xsl:choose>
105 </a>
106 </li>
107 </xsl:template>
108
109</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.