Added Google+ link
[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="{$docroot}/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="{$docroot}/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="{$docroot}/doc/plus-12x12.png"  width="12" height="12" class="expand"/>
46             <img src="{$docroot}/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:choose>
79                   <xsl:when test="position()&lt;10">
80                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',0,position(),'.html')"/>
81                   </xsl:when>
82                   <xsl:otherwise>
83                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',position(),'.html')"/>
84                   </xsl:otherwise>
85                </xsl:choose>
86             </xsl:variable>
87
88          <!-- Chapter info -->
89             <li class="chapter">
90                <xsl:if test="section">
91                   <div class="button"/>
92                </xsl:if>
93
94                <span class="chapter_title">
95                   <xsl:if test="not(section)">
96                      <xsl:attribute name="class">chapter_title nosub</xsl:attribute>
97                   </xsl:if>
98                   <xsl:value-of select="concat(position(),'. ')"/>
99                   <a href="{$chapter_url}">
100                      <xsl:apply-templates select="title"/>
101                   </a>
102                </span>
103
104                <xsl:if test="section">
105                   <ul class="sections">
106                      <xsl:apply-templates select="section">
107                         <xsl:with-param name="chapter_url" select="$chapter_url"/>
108                      </xsl:apply-templates>
109                   </ul>
110                </xsl:if>
111             </li>
112       </xsl:template>
113
114    <!-- Section -->
115       <xsl:template match="/book/chapter/section">
116          <xsl:param name="chapter_url"/>
117          <li class="section">
118             <xsl:value-of select="concat(position(),'. ')"/>
119             <a class="section_title" href="{$chapter_url}#{@id}">
120                <xsl:apply-templates select="title"/>
121             </a>
122          </li>
123       </xsl:template>
124
125    <!-- Chapter/Section Title -->
126       <xsl:template match="title|chapter/title|section/title">
127          <xsl:apply-templates/>
128       </xsl:template>
129
130 </xsl:stylesheet>