1 <!-- $Cambridge: exim/doc/doc-docbook/MyStyle-fo.xsl,v 1.4 2006/04/04 14:03:49 ph10 Exp $ -->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format"
7 <!-- This stylesheet driver contains changes that I want to apply to the
8 printed output form of both the filter document and the main Exim
9 specification. It is imported by MyStyle-filter-fo.xsl and MyStyle-spec-fo.xsl.
12 <xsl:import href="MyTitleStyle.xsl"/>
16 <!-- Set A4 paper, double sided -->
18 <xsl:param name="paper.type" select="'A4'"></xsl:param>
20 <!-- This currently causes errors
21 <xsl:param name="double.sided" select="1"></xsl:param>
24 <!-- Let's have whatever fop extensions there are -->
26 <xsl:param name="fop.extensions" select="1"></xsl:param>
28 <!-- Arrange for the table of contents to be an even number of pages. The name
29 "lot" includes all pages that contain a "list of titles", which in our case is
32 <xsl:template name="force.page.count">
33 <xsl:param name="element" select="local-name(.)"/>
34 <xsl:param name="master-reference" select="''"/>
36 <xsl:when test="$master-reference = 'lot'">end-on-even</xsl:when>
37 <xsl:otherwise>no-force</xsl:otherwise>
41 <!-- Allow for typed index entries. The "role" setting works with DocBook
42 version 4.2 or earlier. Later versions (which we are not currently using)
45 <xsl:param name="index.on.type" select="1"></xsl:param>
46 <xsl:param name="index.on.role" select="1"></xsl:param>
48 <!-- The default uses short chapter titles in the TOC! I want them only for
49 use in footer lines. So we have to modify this template. I changed
50 "titleabbrev.markup" to "title.markup". While I'm here, I also made chapter
51 entries print in bold. -->
53 <xsl:template name="toc.line">
54 <xsl:variable name="id">
55 <xsl:call-template name="object.id"/>
58 <xsl:variable name="label">
59 <xsl:apply-templates select="." mode="label.markup"/>
62 <fo:block text-align-last="justify"
63 end-indent="{$toc.indent.width}pt"
64 last-line-end-indent="-{$toc.indent.width}pt">
65 <fo:inline keep-with-next.within-line="always">
66 <!-- Added lines for bold -->
68 <xsl:when test="self::chapter">
69 <xsl:attribute name="font-weight">bold</xsl:attribute>
71 <xsl:when test="self::index">
72 <xsl:attribute name="font-weight">bold</xsl:attribute>
75 <!-- .................. -->
76 <fo:basic-link internal-destination="{$id}">
77 <xsl:if test="$label != ''">
78 <xsl:copy-of select="$label"/>
79 <xsl:value-of select="$autotoc.label.separator"/>
81 <xsl:apply-templates select="." mode="title.markup"/>
84 <fo:inline keep-together.within-line="always">
85 <xsl:text> </xsl:text>
86 <fo:leader leader-pattern="dots"
87 leader-pattern-width="3pt"
88 leader-alignment="reference-area"
89 keep-with-next.within-line="always"/>
90 <xsl:text> </xsl:text>
91 <fo:basic-link internal-destination="{$id}">
92 <fo:page-number-citation ref-id="{$id}"/>
100 Adjust the sizes of the fonts for titles; the defaults are too gross.
103 <!-- Level 1 is sect1 level -->
105 <xsl:attribute-set name="section.title.level1.properties">
106 <xsl:attribute name="font-size">
107 <xsl:value-of select="$body.font.master * 1.2"></xsl:value-of>
108 <xsl:text>pt</xsl:text>
113 <!-- Fiddling with chapter titles is more messy -->
115 <xsl:template match="title" mode="chapter.titlepage.recto.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}"
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]"/>
128 <xsl:template match="title" mode="chapter.titlepage.verso.auto.mode">
129 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
130 xsl:use-attribute-sets="chapter.titlepage.recto.style"
131 margin-left="{$title.margin.left}"
134 font-family="{$title.font.family}">
135 <xsl:call-template name="component.title">
136 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
142 <!-- This provides a hard pagebreak mechanism as a get-out -->
144 <xsl:template match="processing-instruction('hard-pagebreak')">
145 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
150 <!-- Sort out the footer. Useful information is available at
151 http://www.sagehill.net/docbookxsl/PrintHeaders.html
154 <xsl:attribute-set name="footer.content.properties">
155 <!-- <xsl:attribute name="font-family">serif</xsl:attribute> -->
156 <!-- <xsl:attribute name="font-size">9pt</xsl:attribute> -->
157 <xsl:attribute name="font-style">italic</xsl:attribute>
161 <!-- The default cell widths make the centre one too large -->
163 <xsl:param name="footer.column.widths">4 1 4</xsl:param>
166 <!-- Put the abbreviated chapter titles in running feet, and add the chapter
167 number afterwards in parentheses. I changed title.markup to titleabbrev.markup,
168 and added some lines.
171 <xsl:template name="footer.content">
172 <xsl:param name="pageclass" select="''"/>
173 <xsl:param name="sequence" select="''"/>
174 <xsl:param name="position" select="''"/>
175 <xsl:param name="gentext-key" select="''"/>
178 <!-- pageclass can be front, body, back -->
179 <!-- sequence can be odd, even, first, blank -->
180 <!-- position can be left, center, right -->
182 <xsl:when test="$pageclass = 'titlepage'">
183 <!-- nop; no footer on title pages -->
186 <xsl:when test="$double.sided != 0 and $sequence = 'even'
187 and $position='left'">
191 <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
192 and $position='right'">
196 <xsl:when test="$double.sided = 0 and $position='center'">
200 <!-- This clause added by PH -->
201 <xsl:when test="$double.sided = 0 and $position='right' and $pageclass='body'">
202 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
203 <xsl:text> (</xsl:text>
204 <xsl:apply-templates select="." mode="label.markup"/>
205 <xsl:text>)</xsl:text>
208 <!-- Changed title.markup to titleabbrev.markup for TOC -->
209 <xsl:when test="$double.sided = 0 and $position='right'">
210 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
213 <xsl:when test="$sequence='blank'">
215 <xsl:when test="$double.sided != 0 and $position = 'left'">
218 <xsl:when test="$double.sided = 0 and $position = 'center'">
235 <!-- Arrange for ordered list numbers to be in parentheses instead of just
236 followed by a dot, which I don't like. Unfortunately, this styling is
237 output-specific, so we have to do it separately for FO and HTML output. -->
239 <xsl:template match="orderedlist/listitem" mode="item-number">
240 <xsl:variable name="numeration">
241 <xsl:call-template name="list.numeration">
242 <xsl:with-param name="node" select="parent::orderedlist"/>
246 <xsl:variable name="type">
248 <xsl:when test="$numeration='arabic'">(1)</xsl:when>
249 <xsl:when test="$numeration='loweralpha'">(a)</xsl:when>
250 <xsl:when test="$numeration='lowerroman'">(i)</xsl:when>
251 <xsl:when test="$numeration='upperalpha'">(A)</xsl:when>
252 <xsl:when test="$numeration='upperroman'">(I)</xsl:when>
253 <!-- What!? This should never happen -->
256 <xsl:text>Unexpected numeration: </xsl:text>
257 <xsl:value-of select="$numeration"/>
259 <xsl:value-of select="1."/>
264 <xsl:variable name="item-number">
265 <xsl:call-template name="orderedlist-item-number"/>
268 <xsl:if test="parent::orderedlist/@inheritnum='inherit'
269 and ancestor::listitem[parent::orderedlist]">
270 <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]"
274 <xsl:number value="$item-number" format="{$type}"/>