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