File: index.xsl

package info (click to toggle)
eximdoc4 4.96-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,764 kB
  • sloc: perl: 935; javascript: 182; makefile: 174; xml: 68; sh: 63
file content (118 lines) | stat: -rw-r--r-- 4,178 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   
   <!-- WRAPPER -->
      <xsl:import href="../wrapper.xsl"/>
      <xsl:template match="/"> <xsl:apply-imports/> </xsl:template>
      <xsl:template name="content"><xsl:apply-templates/></xsl:template>
      
   <!-- Where am I relative to the root. Lets mirrors host this in subfolders -->
      <xsl:variable name="docroot" select="'../../../..'"/>

   <!-- Title -->
      <xsl:variable name="html.head.title" select="/book/bookinfo/title"/>

   <xsl:variable name="html.head.append">

      <!-- CSS -->
         <link rel="stylesheet" type="text/css" href="index.css"/>

      <!-- Canonical -->
         <link rel="canonical" href="{/book/canonical_url}"/>

   </xsl:variable>

   <!-- CONTENT -->
      <xsl:template match="/book">
         <xsl:if test="current_url">
            <p id="old_version_warning">
               <strong>WARNING:</strong>
	       <xsl:text> This documentation is for an old version of Exim (</xsl:text>
	       <a href="{current_url}">latest</a>
               <xsl:text>)</xsl:text>
            </p>
         </xsl:if>
         <div id="info">
            <xsl:apply-templates select="bookinfo"/>
         </div>
         <div id="options" class="hidden">
            <img src="{$staticroot}/doc/plus-12x12.png"  width="12" height="12" class="expand"/>
            <img src="{$staticroot}/doc/minus-12x12.png" width="12" height="12" class="collapse"/>
	    <xsl:text>Expand/Collapse all Chapters</xsl:text>
         </div>
         <div id="index">
            <ul id="chapters">
               <xsl:apply-templates select="chapter"/>
            </ul>
         </div>
      </xsl:template>

   <!-- Info -->
      <xsl:template match="/book/bookinfo">
         <h2>
            <xsl:apply-templates select="title"/>
         </h2>
         <p>
            <xsl:text>Copyright</xsl:text>
            <xsl:value-of select="concat(' © ',copyright/year)"/>
            <xsl:text> </xsl:text>
            <xsl:apply-templates select="copyright/holder"/><br/>
            <xsl:text>Revision </xsl:text>
            <xsl:apply-templates select="revhistory/revision/revnumber"/>
            <xsl:text> - </xsl:text>
            <xsl:apply-templates select="revhistory/revision/date"/>
         </p>
      </xsl:template>

   <!-- Chapter -->
      <xsl:template match="/book/chapter">

         <!-- Calculate the URL to the chapter. Store in $chapter_url -->
            <xsl:variable name="chapter_url">
               <xsl:value-of select="concat(/book/prepend_chapter,'ch-',title_uri,'.html')"/>
            </xsl:variable>

         <!-- Chapter info -->
            <li class="chapter">
               <xsl:if test="section">
                  <div class="button"/>
               </xsl:if>

               <span class="chapter_title">
                  <xsl:if test="not(section)">
                     <xsl:attribute name="class">chapter_title nosub</xsl:attribute>
                  </xsl:if>
                  <xsl:value-of select="concat(position(),'. ')"/>
                  <a href="{$chapter_url}">
                     <xsl:apply-templates select="title"/>
                  </a>
               </span>

               <xsl:if test="section">
                  <ul class="sections">
                     <xsl:apply-templates select="section">
                        <xsl:with-param name="chapter_url" select="$chapter_url"/>
                     </xsl:apply-templates>
                  </ul>
               </xsl:if>
            </li>
      </xsl:template>

   <!-- Section -->
      <xsl:template match="/book/chapter/section">
         <xsl:param name="chapter_url"/>
         <li class="section">
            <xsl:value-of select="concat(position(),'. ')"/>
            <a class="section_title" href="{$chapter_url}#{@id}">
               <xsl:apply-templates select="title"/>
            </a>
         </li>
      </xsl:template>

   <!-- Chapter/Section Title -->
      <xsl:template match="title|chapter/title|section/title">
         <xsl:apply-templates/>
      </xsl:template>

</xsl:stylesheet>