Display a warning to the user if they're viewing old versions of the
[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          <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                <xsl:value-of select="concat('Chapter ',chapter_id,' - ',title)"/>
64             </h2>
65
66             <!-- Chapter Info -->
67                <xsl:apply-templates select="*[name()!='section']"/>
68                <xsl:apply-templates select="section"/>
69          </div>
70
71          <!-- Navigation -->
72             <a class="previous_page" href="{prev_url}"><![CDATA[<-previous]]></a>
73             <a class="next_page"     href="{next_url}"><![CDATA[next->]]></a>
74
75       </xsl:template>
76
77    <!-- Section -->
78       <xsl:template match="/chapter/section">
79          <!-- Section Wrapper -->
80          <div class="section{@class}">
81
82             <!-- Section Title -->
83             <xsl:choose>
84                <xsl:when test="@class='index'">
85                   <h3 id="{@id}" class="{@class}">
86                      <xsl:value-of select="title"/>
87                   </h3>
88                </xsl:when>
89                <xsl:otherwise>
90                   <h3 id="{@id}" class="{@class}">
91                      <xsl:value-of select="concat(position(),'. ',title)"/>
92                   </h3>
93                </xsl:otherwise>
94             </xsl:choose>
95
96             <!-- Section Paragraphs -->
97             <xsl:apply-templates select="*"/>
98          </div>
99       </xsl:template>
100
101    <!-- Section paragraph -->
102       <xsl:template match="/chapter/section/para">
103          <p>
104             <xsl:if test="@revisionflag!=''"><xsl:attribute name="class">changed</xsl:attribute></xsl:if>
105             <xsl:apply-templates/>
106          </p>
107       </xsl:template>
108
109    <!-- Ignore -->
110       <xsl:template match="chapter_id|prev_url|next_url|canonical_url|current_url"/>
111
112 </xsl:stylesheet>