Bugtrack 1281 - Spec typo fix.
[exim.git] / doc / doc-docbook / MyStyle-html.xsl
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
2
3 <!-- This stylesheet driver imports my common stylesheet that makes some
4 changes that are wanted for all forms of output. Then it makes changes that are
5 specific to HTML output. -->
6
7 <xsl:import href="MyStyle.xsl"/>
8
9
10 <!-- This removes the title of the current page from the top of the page -
11 redundant because each page is a chapter, whose title shows just below. It also
12 removes the titles of the next/prev at the bottom of the page, but I don't
13 think that matters too much. -->
14
15 <xsl:param name="navig.showtitles" select="'0'"/>
16
17
18 <!-- This allows for the setting of RevisionFlag on elements. -->
19
20 <xsl:param name="show.revisionflag" select="'1'"/>
21
22 <!-- This adds an in-line style to the generated HTML. We need this for the
23 RevisionFlag stuff. While we are at it, we also set the style for
24 <literallayout> blocks. -->
25
26 <xsl:template name="system.head.content">
27 <style type="text/css">
28 <xsl:text>
29 div.added { background-color: #ffff99; }
30 div.deleted { text-decoration: line-through;
31 background-color: #FF7F7F; }
32 div.changed { background-color: #99ff99; }
33 div.off { }
34
35 span.added { background-color: #ffff99; }
36 span.deleted { text-decoration: line-through;
37 background-color: #FF7F7F; }
38 span.changed { background-color: #99ff99; }
39 span.off { }
40
41 <!-- Styles for <literallayout> -->
42
43 pre.literallayout {
44 background-color: #E8E8D0;
45 padding-left: 0.5cm;
46 padding-top: 5px;
47 padding-bottom: 5px;
48 }
49
50 div[class=changed] pre.literallayout {
51 background-color: #99ff99;
52 padding-left: 0.5cm;
53 padding-top: 5px;
54 padding-bottom: 5px;
55 }
56
57 div.literallayout {
58 background-color: #E8E8D0;
59 padding-left: 0.5cm;
60 padding-top: 5px;
61 padding-bottom: 5px;
62 }
63
64 div[class=changed] div.literallayout {
65 background-color: #99ff99;
66 padding-left: 0.5cm;
67 padding-top: 5px;
68 padding-bottom: 5px;
69 }
70
71 </xsl:text>
72 </style>
73 </xsl:template>
74
75 <!-- Here's the template for the actual revision flag thingy. -->
76
77 <xsl:template match="*[@revisionflag]">
78 <xsl:choose>
79 <xsl:when test="local-name(.) = 'para' or local-name(.) = 'simpara' or local-name(.) = 'formalpara' or local-name(.) = 'section' or local-name(.) = 'sect1' or local-name(.) = 'sect2' or local-name(.) = 'sect3' or local-name(.) = 'sect4' or local-name(.) = 'sect5' or local-name(.) = 'chapter' or local-name(.) = 'preface' or local-name(.) = 'itemizedlist' or local-name(.) = 'varlistentry' or local-name(.) = 'glossary' or local-name(.) = 'bibliography' or local-name(.) = 'index' or local-name(.) = 'appendix'">
80 <div class="{@revisionflag}">
81 <xsl:apply-imports/>
82 </div>
83 </xsl:when>
84 <xsl:when test="local-name(.) = 'phrase' or local-name(.) = 'ulink' or local-name(.) = 'link' or local-name(.) = 'filename' or local-name(.) = 'literal' or local-name(.) = 'member' or local-name(.) = 'glossterm' or local-name(.) = 'sgmltag' or local-name(.) = 'quote' or local-name(.) = 'emphasis' or local-name(.) = 'command' or local-name(.) = 'xref'">
85 <span class="{@revisionflag}">
86 <xsl:apply-imports/>
87 </span>
88 </xsl:when>
89 <xsl:when test="local-name(.) = 'listitem' or local-name(.) = 'entry' or local-name(.) = 'title'">
90 <!-- nop; these are handled directly in the stylesheet -->
91 <xsl:apply-imports/>
92 </xsl:when>
93 <xsl:otherwise>
94 <xsl:message>
95 <xsl:text>Revisionflag on unexpected element: </xsl:text>
96 <xsl:value-of select="local-name(.)"/>
97 <xsl:text> (Assuming block)</xsl:text>
98 </xsl:message>
99 <div class="{@revisionflag}">
100 <xsl:apply-imports/>
101 </div>
102 </xsl:otherwise>
103 </xsl:choose>
104 </xsl:template>
105
106
107 <!-- The default uses short chapter titles in the TOC! I want them only for
108 use in footer lines in printed output. So we have to modify this template. I
109 changed "titleabbrev.markup" to "title.markup". -->
110
111 <xsl:template name="toc.line">
112 <xsl:param name="toc-context" select="."/>
113 <xsl:param name="depth" select="1"/>
114 <xsl:param name="depth.from.context" select="8"/>
115
116 <span>
117 <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
118 <a>
119 <xsl:attribute name="href">
120 <xsl:call-template name="href.target">
121 <xsl:with-param name="context" select="$toc-context"/>
122 </xsl:call-template>
123 </xsl:attribute>
124
125 <xsl:variable name="label">
126 <xsl:apply-templates select="." mode="label.markup"/>
127 </xsl:variable>
128 <xsl:copy-of select="$label"/>
129 <xsl:if test="$label != ''">
130 <xsl:value-of select="$autotoc.label.separator"/>
131 </xsl:if>
132
133 <xsl:apply-templates select="." mode="title.markup"/>
134 </a>
135 </span>
136 </xsl:template>
137
138
139 <!-- The default stylesheets generate both chapters and sections with <h2>
140 headings in the HTML. The argument is that the HTML headings don't go deep
141 enough to match the DocBook levels. But surely it would be better to stop them
142 at the bottom end? Anyway, the Exim documents have only one level of section
143 within chapters, and even if they went to two, it wouldn't exhaust HTML's
144 capabilities. So I have copied the style stuff here, making a 1-character
145 change from "+ 1" to "+ 2" in roughly the middle. -->
146
147 <xsl:template name="section.heading">
148 <xsl:param name="section" select="."/>
149 <xsl:param name="level" select="1"/>
150 <xsl:param name="allow-anchors" select="1"/>
151 <xsl:param name="title"/>
152 <xsl:param name="class" select="'title'"/>
153
154 <xsl:variable name="id">
155 <xsl:choose>
156 <!-- if title is in an *info wrapper, get the grandparent -->
157 <xsl:when test="contains(local-name(..), 'info')">
158 <xsl:call-template name="object.id">
159 <xsl:with-param name="object" select="../.."/>
160 </xsl:call-template>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:call-template name="object.id">
164 <xsl:with-param name="object" select=".."/>
165 </xsl:call-template>
166 </xsl:otherwise>
167 </xsl:choose>
168 </xsl:variable>
169
170 <!-- HTML H level is two higher than section level -->
171 <xsl:variable name="hlevel" select="$level + 2"/>
172 <xsl:element name="h{$hlevel}">
173 <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
174 <xsl:if test="$css.decoration != '0'">
175 <xsl:if test="$hlevel&lt;3">
176 <xsl:attribute name="style">clear: both</xsl:attribute>
177 </xsl:if>
178 </xsl:if>
179 <xsl:if test="$allow-anchors != 0">
180 <xsl:call-template name="anchor">
181 <xsl:with-param name="node" select="$section"/>
182 <xsl:with-param name="conditional" select="0"/>
183 </xsl:call-template>
184 </xsl:if>
185 <xsl:copy-of select="$title"/>
186 </xsl:element>
187 </xsl:template>
188
189
190 </xsl:stylesheet>