Fix IE7 bug which causes the TOC to immediately close after opening
[exim-website.git] / templates / doc / chapter.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4    
5    <!-- WRAPPER -->
6       <xsl:import href="../wrapper.xsl"/>
7       <xsl:template match="/"> <xsl:apply-imports/> </xsl:template>
8       <xsl:template name="content"><xsl:apply-templates/></xsl:template>
9       
10    <!-- Where am I relative to the root. Lets mirrors host this in subfolders -->
11       <xsl:variable name="docroot" select="'../../../..'"/>
12
13    <!-- Title -->
14       <xsl:variable name="html.head.title" select="concat(/chapter/chapter_id,'. ',/chapter/title)"/>
15
16    <xsl:variable name="html.head.append">
17
18       <!-- CSS -->
19          <link rel="stylesheet" type="text/css" href="{$docroot}/doc/chapter.css"/>
20
21       <!-- Canonical -->
22          <link rel="canonical" href="{/chapter/canonical_url}"/>
23
24    </xsl:variable>
25  
26    <!-- JavaScript -->
27       <xsl:variable name="html.body.append">
28          <script type="text/javascript" src="{$docroot}/doc/chapter.js"/>
29       </xsl:variable>
30
31    <!-- Table of Contents -->
32       <xsl:variable name="html.body.outer.append">
33          <div id="toc">
34             <ul class="hidden"/>
35             <img src="../../../../doc/contents.png" width="16" height="155"/>
36          </div>
37       </xsl:variable>
38
39    <!-- CONTENT -->
40       <xsl:template match="/chapter">
41
42          <!-- Navigation -->
43          <a class="previous_page" href="{prev_url}"><![CDATA[<-previous]]></a>
44          <a class="next_page"     href="{next_url}"><![CDATA[next->]]></a>
45
46          <!-- Chapter Wrapper -->
47          <div id="chapter" class="chapter{@class}">
48
49             <!-- Chapter Title -->
50             <h2 id="{@id}" class="{@class}">
51                <xsl:value-of select="concat('Chapter ',chapter_id,' - ',title)"/>
52             </h2>
53
54             <!-- Chapter Info -->
55                <xsl:apply-templates select="*[name()!='section']"/>
56                <xsl:apply-templates select="section"/>
57          </div>
58
59          <!-- Navigation -->
60             <a class="previous_page" href="{prev_url}"><![CDATA[<-previous]]></a>
61             <a class="next_page"     href="{next_url}"><![CDATA[next->]]></a>
62
63       </xsl:template>
64
65    <!-- Section -->
66       <xsl:template match="/chapter/section">
67          <!-- Section Wrapper -->
68          <div class="section{@class}">
69
70             <!-- Section Title -->
71             <xsl:choose>
72                <xsl:when test="@class='index'">
73                   <h3 id="{@id}" class="{@class}">
74                      <xsl:value-of select="title"/>
75                   </h3>
76                </xsl:when>
77                <xsl:otherwise>
78                   <h3 id="{@id}" class="{@class}">
79                      <xsl:value-of select="concat(position(),'. ',title)"/>
80                   </h3>
81                </xsl:otherwise>
82             </xsl:choose>
83
84             <!-- Section Paragraphs -->
85             <xsl:apply-templates select="*"/>
86          </div>
87       </xsl:template>
88
89    <!-- Section paragraph -->
90       <xsl:template match="/chapter/section/para">
91          <p>
92             <xsl:if test="@revisionflag!=''"><xsl:attribute name="class">changed</xsl:attribute></xsl:if>
93             <xsl:apply-templates/>
94          </p>
95       </xsl:template>
96
97    <!-- Ignore -->
98       <xsl:template match="chapter_id|prev_url|next_url|canonical_url"/>
99
100 </xsl:stylesheet>