1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:fo="http://www.w3.org/1999/XSL/Format"
5 <!-- This stylesheet driver contains changes that I want to apply to the
6 printed output form of both the filter document and the main Exim
7 specification. It is imported by MyStyle-filter-fo.xsl and MyStyle-spec-fo.xsl.
10 <xsl:import href="MyTitleStyle.xsl"/>
14 <!-- Set A4 paper, double sided -->
16 <xsl:param name="paper.type" select="'A4'"></xsl:param>
18 <!-- This currently causes errors
19 <xsl:param name="double.sided" select="1"></xsl:param>
22 <!-- Let's have whatever fop extensions there are -->
24 <xsl:param name="fop.extensions" select="1"></xsl:param>
26 <!-- Arrange for the table of contents to be an even number of pages. The name
27 "lot" includes all pages that contain a "list of titles", which in our case is
30 <xsl:template name="force.page.count">
31 <xsl:param name="element" select="local-name(.)"/>
32 <xsl:param name="master-reference" select="''"/>
34 <xsl:when test="$master-reference = 'lot'">end-on-even</xsl:when>
35 <xsl:otherwise>no-force</xsl:otherwise>
39 <!-- Allow for typed index entries. The "role" setting works with DocBook
40 version 4.2 or earlier. Later versions (which we are not currently using)
43 <xsl:param name="index.on.type" select="1"></xsl:param>
44 <xsl:param name="index.on.role" select="1"></xsl:param>
46 <!-- The default uses short chapter titles in the TOC! I want them only for
47 use in footer lines. So we have to modify this template. I changed
48 "titleabbrev.markup" to "title.markup". While I'm here, I also made chapter
49 entries print in bold. -->
51 <xsl:template name="toc.line">
52 <xsl:variable name="id">
53 <xsl:call-template name="object.id"/>
56 <xsl:variable name="label">
57 <xsl:apply-templates select="." mode="label.markup"/>
60 <fo:block text-align-last="justify"
61 end-indent="{$toc.indent.width}pt"
62 last-line-end-indent="-{$toc.indent.width}pt">
63 <fo:inline keep-with-next.within-line="always">
64 <!-- Added lines for bold -->
66 <xsl:when test="self::chapter">
67 <xsl:attribute name="font-weight">bold</xsl:attribute>
69 <xsl:when test="self::index">
70 <xsl:attribute name="font-weight">bold</xsl:attribute>
73 <!-- .................. -->
74 <fo:basic-link internal-destination="{$id}">
75 <xsl:if test="$label != ''">
76 <xsl:copy-of select="$label"/>
77 <xsl:value-of select="$autotoc.label.separator"/>
79 <xsl:apply-templates select="." mode="title.markup"/>
82 <fo:inline keep-together.within-line="always">
83 <xsl:text> </xsl:text>
84 <fo:leader leader-pattern="dots"
85 leader-pattern-width="3pt"
86 leader-alignment="reference-area"
87 keep-with-next.within-line="always"/>
88 <xsl:text> </xsl:text>
89 <fo:basic-link internal-destination="{$id}">
90 <fo:page-number-citation ref-id="{$id}"/>
98 Adjust the sizes of the fonts for titles; the defaults are too gross.
101 <!-- Level 1 is sect1 level -->
103 <xsl:attribute-set name="section.title.level1.properties">
104 <xsl:attribute name="font-size">
105 <xsl:value-of select="$body.font.master * 1.2"></xsl:value-of>
106 <xsl:text>pt</xsl:text>
111 <!-- Fiddling with chapter titles is more messy -->
113 <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
114 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
115 xsl:use-attribute-sets="chapter.titlepage.recto.style"
116 margin-left="{$title.margin.left}"
119 font-family="{$title.font.family}">
120 <xsl:call-template name="component.title">
121 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
126 <xsl:template match="title" mode="chapter.titlepage.verso.auto.mode">
127 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
128 xsl:use-attribute-sets="chapter.titlepage.recto.style"
129 margin-left="{$title.margin.left}"
132 font-family="{$title.font.family}">
133 <xsl:call-template name="component.title">
134 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
140 <!-- This provides a hard pagebreak mechanism as a get-out -->
142 <xsl:template match="processing-instruction('hard-pagebreak')">
143 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
148 <!-- Sort out the footer. Useful information is available at
149 http://www.sagehill.net/docbookxsl/PrintHeaders.html
152 <xsl:attribute-set name="footer.content.properties">
153 <!-- <xsl:attribute name="font-family">serif</xsl:attribute> -->
154 <!-- <xsl:attribute name="font-size">9pt</xsl:attribute> -->
155 <xsl:attribute name="font-style">italic</xsl:attribute>
159 <!-- The default cell widths make the centre one too large -->
161 <xsl:param name="footer.column.widths">4 1 4</xsl:param>
164 <!-- Put the abbreviated chapter titles in running feet, and add the chapter
165 number afterwards in parentheses. I changed title.markup to titleabbrev.markup,
166 and added some lines.
169 <xsl:template name="footer.content">
170 <xsl:param name="pageclass" select="''"/>
171 <xsl:param name="sequence" select="''"/>
172 <xsl:param name="position" select="''"/>
173 <xsl:param name="gentext-key" select="''"/>
176 <!-- pageclass can be front, body, back -->
177 <!-- sequence can be odd, even, first, blank -->
178 <!-- position can be left, center, right -->
180 <xsl:when test="$pageclass = 'titlepage'">
181 <!-- nop; no footer on title pages -->
184 <xsl:when test="$double.sided != 0 and $sequence = 'even'
185 and $position='left'">
189 <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
190 and $position='right'">
194 <xsl:when test="$double.sided = 0 and $position='center'">
198 <!-- This clause added by PH -->
199 <xsl:when test="$double.sided = 0 and $position='right' and $pageclass='body'">
200 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
201 <xsl:text> (</xsl:text>
202 <xsl:apply-templates select="." mode="label.markup"/>
203 <xsl:text>)</xsl:text>
206 <!-- Changed title.markup to titleabbrev.markup for TOC -->
207 <xsl:when test="$double.sided = 0 and $position='right'">
208 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
211 <xsl:when test="$sequence='blank'">
213 <xsl:when test="$double.sided != 0 and $position = 'left'">
216 <xsl:when test="$double.sided = 0 and $position = 'center'">
233 <!-- Arrange for ordered list numbers to be in parentheses instead of just
234 followed by a dot, which I don't like. Unfortunately, this styling is
235 output-specific, so we have to do it separately for FO and HTML output. -->
237 <xsl:param name="orderedlist.label.width" select="'2.0em'"></xsl:param>
239 <xsl:attribute-set name="orderedlist.label.properties">
240 <xsl:attribute name="text-align">left</xsl:attribute>
243 <xsl:template match="orderedlist/listitem" mode="item-number">
244 <xsl:variable name="numeration">
245 <xsl:call-template name="list.numeration">
246 <xsl:with-param name="node" select="parent::orderedlist"/>
250 <xsl:variable name="type">
252 <xsl:when test="$numeration='arabic'">(1)</xsl:when>
253 <xsl:when test="$numeration='loweralpha'">(a)</xsl:when>
254 <xsl:when test="$numeration='lowerroman'">(i)</xsl:when>
255 <xsl:when test="$numeration='upperalpha'">(A)</xsl:when>
256 <xsl:when test="$numeration='upperroman'">(I)</xsl:when>
257 <!-- What!? This should never happen -->
260 <xsl:text>Unexpected numeration: </xsl:text>
261 <xsl:value-of select="$numeration"/>
263 <xsl:value-of select="1."/>
268 <xsl:variable name="item-number">
269 <xsl:call-template name="orderedlist-item-number"/>
272 <xsl:if test="parent::orderedlist/@inheritnum='inherit'
273 and ancestor::listitem[parent::orderedlist]">
274 <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]"
278 <xsl:number value="$item-number" format="{$type}"/>