17d772ad7a16cfa287fc448675ec22bb972f7290
[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="{$staticroot}/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="{$staticroot}/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="{$staticroot}/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          <xsl:if test="next_url">
45             <a class="next_page"  href="{next_url}"><![CDATA[next->]]></a>
46          </xsl:if>
47
48          <!-- Chapter Wrapper -->
49          <div id="chapter" class="chapter{@class}">
50
51             <xsl:if test="current_url">
52                <p id="old_version_warning">
53                   <span class="closebar"><a href="#" title="Close">X</a></span>
54                   <strong>WARNING:</strong>
55                   <xsl:text> This documentation is for an old version of Exim (</xsl:text>
56                   <a href="{current_url}">latest</a>
57                   <xsl:text>)</xsl:text>
58                </p>
59             </xsl:if>
60
61             <!-- Chapter Title -->
62             <h2 id="{@id}" class="{@class}">
63                <a href="{this_url}">
64                   <xsl:value-of select="concat('Chapter ',chapter_id,' - ',title)"/>
65                </a>
66             </h2>
67
68             <!-- Chapter Info -->
69                <xsl:apply-templates select="*[name()!='section']"/>
70                <xsl:apply-templates select="section"/>
71          </div>
72
73          <!-- Navigation -->
74             <a class="previous_page" href="{prev_url}"><![CDATA[<-previous]]></a>
75             <a class="toc_page"      href="{toc_url}"><![CDATA[Table of Contents]]></a>
76             <xsl:if test="next_url">
77                <a class="next_page"  href="{next_url}"><![CDATA[next->]]></a>
78             </xsl:if>
79
80       </xsl:template>
81
82    <!-- Section -->
83       <xsl:template match="/chapter/section">
84          <!-- Section Wrapper -->
85          <div class="section{@class}">
86
87             <!-- Section Title -->
88             <xsl:choose>
89                <xsl:when test="@class='index'">
90                   <h3 id="{@id}" class="{@class}">
91                      <xsl:value-of select="title"/>
92                   </h3>
93                </xsl:when>
94                <xsl:otherwise>
95                   <h3 id="{@id}" class="{@class}">
96                      <xsl:value-of select="concat(position(),'. ',title)"/>
97                   </h3>
98                </xsl:otherwise>
99             </xsl:choose>
100
101             <!-- Section Paragraphs -->
102             <xsl:apply-templates select="*"/>
103          </div>
104       </xsl:template>
105
106    <!-- Section paragraph -->
107       <xsl:template match="/chapter/section/para">
108          <p>
109             <xsl:if test="@revisionflag!=''"><xsl:attribute name="class">changed</xsl:attribute></xsl:if>
110             <xsl:apply-templates/>
111          </p>
112       </xsl:template>
113
114    <!-- Ignore -->
115       <xsl:template match="chapter_id|this_url|prev_url|next_url|toc_url|canonical_url|current_url|title_uri|old_versions"/>
116
117 </xsl:stylesheet>