Adjust Mike Cardwell attribution, per his request
[exim-website.git] / templates / doc / index.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="/book/bookinfo/title"/>
15
16    <xsl:variable name="html.head.append">
17
18       <!-- CSS -->
19          <link rel="stylesheet" type="text/css" href="{$staticroot}/doc/index.css"/>
20
21       <!-- Canonical -->
22          <link rel="canonical" href="{/book/canonical_url}"/>
23
24    </xsl:variable>
25  
26    <!-- JavaScript -->
27       <xsl:variable name="html.body.append">
28          <script type="text/javascript" src="{$staticroot}/doc/index.js"/>
29       </xsl:variable>
30
31    <!-- CONTENT -->
32       <xsl:template match="/book">
33          <xsl:if test="current_url">
34             <p id="old_version_warning">
35                <strong>WARNING:</strong>
36                <xsl:text> This documentation is for an old version of Exim (</xsl:text>
37                <a href="{current_url}">latest</a>
38                <xsl:text>)</xsl:text>
39             </p>
40          </xsl:if>
41          <div id="info">
42             <xsl:apply-templates select="bookinfo"/>
43          </div>
44          <div id="options" class="hidden">
45             <img src="{$staticroot}/doc/plus-12x12.png"  width="12" height="12" class="expand"/>
46             <img src="{$staticroot}/doc/minus-12x12.png" width="12" height="12" class="collapse"/>
47             <xsl:text>Expand/Collapse all Chapters</xsl:text>
48          </div>
49          <div id="index">
50             <ul id="chapters">
51                <xsl:apply-templates select="chapter"/>
52             </ul>
53          </div>
54       </xsl:template>
55
56    <!-- Info -->
57       <xsl:template match="/book/bookinfo">
58          <h2>
59             <xsl:apply-templates select="title"/>
60          </h2>
61          <p>
62             <xsl:text>Copyright</xsl:text>
63             <xsl:value-of select="concat(' © ',copyright/year)"/>
64             <xsl:text> </xsl:text>
65             <xsl:apply-templates select="copyright/holder"/><br/>
66             <xsl:text>Revision </xsl:text>
67             <xsl:apply-templates select="revhistory/revision/revnumber"/>
68             <xsl:text> - </xsl:text>
69             <xsl:apply-templates select="revhistory/revision/date"/>
70          </p>
71       </xsl:template>
72
73    <!-- Chapter -->
74       <xsl:template match="/book/chapter">
75
76          <!-- Calculate the URL to the chapter. Store in $chapter_url -->
77             <xsl:variable name="chapter_url">
78                <xsl:value-of select="concat(/book/prepend_chapter,'ch-',title_uri,'.html')"/>
79             </xsl:variable>
80
81          <!-- Chapter info -->
82             <li class="chapter">
83                <xsl:if test="section">
84                   <div class="button"/>
85                </xsl:if>
86
87                <span class="chapter_title">
88                   <xsl:if test="not(section)">
89                      <xsl:attribute name="class">chapter_title nosub</xsl:attribute>
90                   </xsl:if>
91                   <xsl:value-of select="concat(position(),'. ')"/>
92                   <a href="{$chapter_url}">
93                      <xsl:apply-templates select="title"/>
94                   </a>
95                </span>
96
97                <xsl:if test="section">
98                   <ul class="sections">
99                      <xsl:apply-templates select="section">
100                         <xsl:with-param name="chapter_url" select="$chapter_url"/>
101                      </xsl:apply-templates>
102                   </ul>
103                </xsl:if>
104             </li>
105       </xsl:template>
106
107    <!-- Section -->
108       <xsl:template match="/book/chapter/section">
109          <xsl:param name="chapter_url"/>
110          <li class="section">
111             <xsl:value-of select="concat(position(),'. ')"/>
112             <a class="section_title" href="{$chapter_url}#{@id}">
113                <xsl:apply-templates select="title"/>
114             </a>
115          </li>
116       </xsl:template>
117
118    <!-- Chapter/Section Title -->
119       <xsl:template match="title|chapter/title|section/title">
120          <xsl:apply-templates/>
121       </xsl:template>
122
123 </xsl:stylesheet>