Remove Asciidoc versions of the documentation and building apparatus;
[exim.git] / doc / doc-docbook / MyStyle-fo.xsl
CommitLineData
9b371988 1<!-- $Cambridge: exim/doc/doc-docbook/MyStyle-fo.xsl,v 1.3 2006/02/01 11:01:01 ph10 Exp $ -->
168e428f
PH
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 version="1.0">
6
7<!-- This stylesheet driver contains changes that I want to apply to the
8printed output form of both the filter document and the main Exim
9specification. It is imported by MyStyle-filter-fo.xsl and MyStyle-spec-fo.xsl.
10-->
11
12<xsl:import href="MyTitleStyle.xsl"/>
13
14
15
16<!-- Set A4 paper, double sided -->
17
18<xsl:param name="paper.type" select="'A4'"></xsl:param>
19
20<!-- This currently causes errors
21<xsl:param name="double.sided" select="1"></xsl:param>
22-->
23
9b371988
PH
24<!-- Let's have whatever fop extensions there are -->
25
26<xsl:param name="fop.extensions" select="1"></xsl:param>
27
168e428f
PH
28<!-- Allow for typed index entries. The "role" setting works with DocBook
29version 4.2 or earlier. Later versions (which we are not currently using)
30need "type". -->
31
32<xsl:param name="index.on.type" select="1"></xsl:param>
33<xsl:param name="index.on.role" select="1"></xsl:param>
34
168e428f
PH
35<!-- The default uses short chapter titles in the TOC! I want them only for
36use in footer lines. So we have to modify this template. I changed
37"titleabbrev.markup" to "title.markup". While I'm here, I also made chapter
38entries print in bold. -->
39
40<xsl:template name="toc.line">
41 <xsl:variable name="id">
42 <xsl:call-template name="object.id"/>
43 </xsl:variable>
44
45 <xsl:variable name="label">
46 <xsl:apply-templates select="." mode="label.markup"/>
47 </xsl:variable>
48
49 <fo:block text-align-last="justify"
50 end-indent="{$toc.indent.width}pt"
51 last-line-end-indent="-{$toc.indent.width}pt">
52 <fo:inline keep-with-next.within-line="always">
53 <!-- Added lines for bold -->
54 <xsl:choose>
55 <xsl:when test="self::chapter">
56 <xsl:attribute name="font-weight">bold</xsl:attribute>
57 </xsl:when>
58 <xsl:when test="self::index">
59 <xsl:attribute name="font-weight">bold</xsl:attribute>
60 </xsl:when>
61 </xsl:choose>
62 <!-- .................. -->
63 <fo:basic-link internal-destination="{$id}">
64 <xsl:if test="$label != ''">
65 <xsl:copy-of select="$label"/>
66 <xsl:value-of select="$autotoc.label.separator"/>
67 </xsl:if>
68 <xsl:apply-templates select="." mode="title.markup"/>
69 </fo:basic-link>
70 </fo:inline>
71 <fo:inline keep-together.within-line="always">
72 <xsl:text> </xsl:text>
73 <fo:leader leader-pattern="dots"
74 leader-pattern-width="3pt"
75 leader-alignment="reference-area"
76 keep-with-next.within-line="always"/>
77 <xsl:text> </xsl:text>
78 <fo:basic-link internal-destination="{$id}">
79 <fo:page-number-citation ref-id="{$id}"/>
80 </fo:basic-link>
81 </fo:inline>
82 </fo:block>
83</xsl:template>
84
85
168e428f
PH
86<!--
87Adjust the sizes of the fonts for titles; the defaults are too gross.
88-->
89
90<!-- Level 1 is sect1 level -->
91
92<xsl:attribute-set name="section.title.level1.properties">
93 <xsl:attribute name="font-size">
94 <xsl:value-of select="$body.font.master * 1.2"></xsl:value-of>
95 <xsl:text>pt</xsl:text>
96 </xsl:attribute>
97</xsl:attribute-set>
98
99
100<!-- Fiddling with chapter titles is more messy -->
101
102<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
103 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
104 xsl:use-attribute-sets="chapter.titlepage.recto.style"
105 margin-left="{$title.margin.left}"
106 font-size="17pt"
107 font-weight="bold"
108 font-family="{$title.font.family}">
109 <xsl:call-template name="component.title">
110 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
111 </xsl:call-template>
112 </fo:block>
113</xsl:template>
114
115<xsl:template match="title" mode="chapter.titlepage.verso.auto.mode">
116 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
117 xsl:use-attribute-sets="chapter.titlepage.recto.style"
118 margin-left="{$title.margin.left}"
119 font-size="17pt"
120 font-weight="bold"
121 font-family="{$title.font.family}">
122 <xsl:call-template name="component.title">
123 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
124 </xsl:call-template>
125 </fo:block>
126</xsl:template>
127
128
129<!-- This provides a hard pagebreak mechanism as a get-out -->
130
131<xsl:template match="processing-instruction('hard-pagebreak')">
132 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
133 </fo:block>
134</xsl:template>
135
136
137<!-- Sort out the footer. Useful information is available at
138http://www.sagehill.net/docbookxsl/PrintHeaders.html
139-->
140
168e428f
PH
141<xsl:attribute-set name="footer.content.properties">
142 <!-- <xsl:attribute name="font-family">serif</xsl:attribute> -->
143 <!-- <xsl:attribute name="font-size">9pt</xsl:attribute> -->
144 <xsl:attribute name="font-style">italic</xsl:attribute>
145</xsl:attribute-set>
146
147
9b371988 148<!-- The default cell widths make the centre one too large -->
168e428f 149
9b371988 150<xsl:param name="footer.column.widths">4 1 4</xsl:param>
168e428f 151
168e428f 152
9b371988
PH
153<!-- Put the abbreviated chapter titles in running feet, and add the chapter
154number afterwards in parentheses. I changed title.markup to titleabbrev.markup,
155and added some lines.
168e428f
PH
156-->
157
168e428f
PH
158<xsl:template name="footer.content">
159 <xsl:param name="pageclass" select="''"/>
160 <xsl:param name="sequence" select="''"/>
161 <xsl:param name="position" select="''"/>
162 <xsl:param name="gentext-key" select="''"/>
163
164 <fo:block>
165 <!-- pageclass can be front, body, back -->
166 <!-- sequence can be odd, even, first, blank -->
167 <!-- position can be left, center, right -->
168 <xsl:choose>
169 <xsl:when test="$pageclass = 'titlepage'">
170 <!-- nop; no footer on title pages -->
171 </xsl:when>
172
173 <xsl:when test="$double.sided != 0 and $sequence = 'even'
174 and $position='left'">
175 <fo:page-number/>
176 </xsl:when>
177
178 <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
179 and $position='right'">
180 <fo:page-number/>
181 </xsl:when>
182
183 <xsl:when test="$double.sided = 0 and $position='center'">
184 <fo:page-number/>
185 </xsl:when>
186
9b371988
PH
187 <!-- This clause added by PH -->
188 <xsl:when test="$double.sided = 0 and $position='right' and $pageclass='body'">
189 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
190 <xsl:text> (</xsl:text>
191 <xsl:apply-templates select="." mode="label.markup"/>
192 <xsl:text>)</xsl:text>
193 </xsl:when>
194
195 <!-- Changed title.markup to titleabbrev.markup for TOC -->
168e428f
PH
196 <xsl:when test="$double.sided = 0 and $position='right'">
197 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
198 </xsl:when>
199
200 <xsl:when test="$sequence='blank'">
201 <xsl:choose>
202 <xsl:when test="$double.sided != 0 and $position = 'left'">
203 <fo:page-number/>
204 </xsl:when>
205 <xsl:when test="$double.sided = 0 and $position = 'center'">
206 <fo:page-number/>
207 </xsl:when>
208 <xsl:otherwise>
209 <!-- nop -->
210 </xsl:otherwise>
211 </xsl:choose>
212 </xsl:when>
213
214 <xsl:otherwise>
215 <!-- nop -->
216 </xsl:otherwise>
217 </xsl:choose>
218 </fo:block>
219</xsl:template>
220
9b371988
PH
221
222<!-- Arrange for ordered list numbers to be in parentheses instead of just
223followed by a dot, which I don't like. Unfortunately, this styling is
224output-specific, so we have to do it separately for FO and HTML output. -->
225
226<xsl:template match="orderedlist/listitem" mode="item-number">
227 <xsl:variable name="numeration">
228 <xsl:call-template name="list.numeration">
229 <xsl:with-param name="node" select="parent::orderedlist"/>
230 </xsl:call-template>
231 </xsl:variable>
232
233 <xsl:variable name="type">
234 <xsl:choose>
235 <xsl:when test="$numeration='arabic'">(1)</xsl:when>
236 <xsl:when test="$numeration='loweralpha'">(a)</xsl:when>
237 <xsl:when test="$numeration='lowerroman'">(i)</xsl:when>
238 <xsl:when test="$numeration='upperalpha'">(A)</xsl:when>
239 <xsl:when test="$numeration='upperroman'">(I)</xsl:when>
240 <!-- What!? This should never happen -->
241 <xsl:otherwise>
242 <xsl:message>
243 <xsl:text>Unexpected numeration: </xsl:text>
244 <xsl:value-of select="$numeration"/>
245 </xsl:message>
246 <xsl:value-of select="1."/>
247 </xsl:otherwise>
248 </xsl:choose>
249 </xsl:variable>
250
251 <xsl:variable name="item-number">
252 <xsl:call-template name="orderedlist-item-number"/>
253 </xsl:variable>
254
255 <xsl:if test="parent::orderedlist/@inheritnum='inherit'
256 and ancestor::listitem[parent::orderedlist]">
257 <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]"
258 mode="item-number"/>
259 </xsl:if>
260
261 <xsl:number value="$item-number" format="{$type}"/>
262</xsl:template>
263
168e428f 264</xsl:stylesheet>