Fixed broken error/help messages
[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          <div id="info">
34             <xsl:apply-templates select="bookinfo"/>
35          </div>
36          <div id="options" class="hidden">
37             <img src="{$docroot}/doc/plus-12x12.png"  width="12" height="12" class="expand"/>
38             <img src="{$docroot}/doc/minus-12x12.png" width="12" height="12" class="collapse"/>
39             <xsl:text>Expand/Collapse all Chapters</xsl:text>
40          </div>
41          <div id="index">
42             <ul id="chapters">
43                <xsl:apply-templates select="chapter"/>
44             </ul>
45          </div>
46       </xsl:template>
47
48    <!-- Info -->
49       <xsl:template match="/book/bookinfo">
50          <h2>
51             <xsl:apply-templates select="title"/>
52          </h2>
53          <p>
54             <xsl:text>Copyright</xsl:text>
55             <xsl:value-of select="concat(' © ',copyright/year)"/>
56             <xsl:text> </xsl:text>
57             <xsl:apply-templates select="copyright/holder"/><br/>
58             <xsl:text>Revision </xsl:text>
59             <xsl:apply-templates select="revhistory/revision/revnumber"/>
60             <xsl:text> - </xsl:text>
61             <xsl:apply-templates select="revhistory/revision/date"/>
62          </p>
63       </xsl:template>
64
65    <!-- Chapter -->
66       <xsl:template match="/book/chapter">
67
68          <!-- Calculate the URL to the chapter. Store in $chapter_url -->
69             <xsl:variable name="chapter_url">
70                <xsl:choose>
71                   <xsl:when test="position()&lt;10">
72                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',0,position(),'.html')"/>
73                   </xsl:when>
74                   <xsl:otherwise>
75                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',position(),'.html')"/>
76                   </xsl:otherwise>
77                </xsl:choose>
78             </xsl:variable>
79
80          <!-- Chapter info -->
81             <li class="chapter">
82                <xsl:if test="section">
83                   <div class="button"/>
84                </xsl:if>
85
86                <span class="chapter_title">
87                   <xsl:if test="not(section)">
88                      <xsl:attribute name="class">chapter_title nosub</xsl:attribute>
89                   </xsl:if>
90                   <xsl:value-of select="concat(position(),'. ')"/>
91                   <a href="{$chapter_url}">
92                      <xsl:apply-templates select="title"/>
93                   </a>
94                </span>
95
96                <xsl:if test="section">
97                   <ul class="sections">
98                      <xsl:apply-templates select="section">
99                         <xsl:with-param name="chapter_url" select="$chapter_url"/>
100                      </xsl:apply-templates>
101                   </ul>
102                </xsl:if>
103             </li>
104       </xsl:template>
105
106    <!-- Section -->
107       <xsl:template match="/book/chapter/section">
108          <xsl:param name="chapter_url"/>
109          <li class="section">
110             <xsl:value-of select="concat(position(),'. ')"/>
111             <a class="section_title" href="{$chapter_url}#{@id}">
112                <xsl:apply-templates select="title"/>
113             </a>
114          </li>
115       </xsl:template>
116
117    <!-- Chapter/Section Title -->
118       <xsl:template match="title|chapter/title|section/title">
119          <xsl:apply-templates/>
120       </xsl:template>
121
122 </xsl:stylesheet>