31d7bc1e8ac11297f2dc925f9b724ae9175bb1fc
[exim-website.git] / templates / doc / toc.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    <!-- Define display/content information -->
6       <xsl:output indent="no"/>
7       <xsl:output encoding="UTF-8"/>
8       <xsl:output media-type="text/xml"/>
9       <xsl:output omit-xml-declaration="no"/>
10    
11    <!-- CONTENT -->
12       <xsl:template match="/">
13          <toc>
14             <xsl:apply-templates select="book/chapter"/>
15          </toc>
16       </xsl:template>
17
18    <!-- Chapter -->
19       <xsl:template match="/book/chapter">
20
21          <!-- Calculate the URL to the chapter. Store in $chapter_url -->
22             <xsl:variable name="chapter_url">
23                <xsl:choose>
24                   <xsl:when test="position()&lt;10">
25                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',0,position(),'.html')"/>
26                   </xsl:when>
27                   <xsl:otherwise>
28                      <xsl:value-of select="concat(/book/prepend_chapter,'ch',position(),'.html')"/>
29                   </xsl:otherwise>
30                </xsl:choose>
31             </xsl:variable>
32
33          <!-- Chapter info -->
34             <c>
35                <u>
36                   <xsl:value-of select="$chapter_url"/>
37                </u>
38                <t>
39                      <xsl:apply-templates select="title"/>
40                </t>
41             </c>
42       </xsl:template>
43
44    <!-- Chapter/Section Title -->
45       <xsl:template match="title|chapter/title">
46          <xsl:apply-templates/>
47       </xsl:template>
48
49 </xsl:stylesheet>