1 <!-- $Cambridge: exim/doc/doc-docbook/MyStyle-fo.xsl,v 1.3 2006/02/01 11:01:01 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 <!-- Allow for typed index entries. The "role" setting works with DocBook
29 version 4.2 or earlier. Later versions (which we are not currently using)
32 <xsl:param name="index.on.type" select="1"></xsl:param>
33 <xsl:param name="index.on.role" select="1"></xsl:param>
35 <!-- The default uses short chapter titles in the TOC! I want them only for
36 use 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
38 entries print in bold. -->
40 <xsl:template name="toc.line">
41 <xsl:variable name="id">
42 <xsl:call-template name="object.id"/>
45 <xsl:variable name="label">
46 <xsl:apply-templates select="." mode="label.markup"/>
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 -->
55 <xsl:when test="self::chapter">
56 <xsl:attribute name="font-weight">bold</xsl:attribute>
58 <xsl:when test="self::index">
59 <xsl:attribute name="font-weight">bold</xsl:attribute>
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"/>
68 <xsl:apply-templates select="." mode="title.markup"/>
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}"/>
87 Adjust the sizes of the fonts for titles; the defaults are too gross.
90 <!-- Level 1 is sect1 level -->
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>
100 <!-- Fiddling with chapter titles is more messy -->
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}"
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]"/>
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}"
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]"/>
129 <!-- This provides a hard pagebreak mechanism as a get-out -->
131 <xsl:template match="processing-instruction('hard-pagebreak')">
132 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
137 <!-- Sort out the footer. Useful information is available at
138 http://www.sagehill.net/docbookxsl/PrintHeaders.html
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>
148 <!-- The default cell widths make the centre one too large -->
150 <xsl:param name="footer.column.widths">4 1 4</xsl:param>
153 <!-- Put the abbreviated chapter titles in running feet, and add the chapter
154 number afterwards in parentheses. I changed title.markup to titleabbrev.markup,
155 and added some lines.
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="''"/>
165 <!-- pageclass can be front, body, back -->
166 <!-- sequence can be odd, even, first, blank -->
167 <!-- position can be left, center, right -->
169 <xsl:when test="$pageclass = 'titlepage'">
170 <!-- nop; no footer on title pages -->
173 <xsl:when test="$double.sided != 0 and $sequence = 'even'
174 and $position='left'">
178 <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
179 and $position='right'">
183 <xsl:when test="$double.sided = 0 and $position='center'">
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>
195 <!-- Changed title.markup to titleabbrev.markup for TOC -->
196 <xsl:when test="$double.sided = 0 and $position='right'">
197 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
200 <xsl:when test="$sequence='blank'">
202 <xsl:when test="$double.sided != 0 and $position = 'left'">
205 <xsl:when test="$double.sided = 0 and $position = 'center'">
222 <!-- Arrange for ordered list numbers to be in parentheses instead of just
223 followed by a dot, which I don't like. Unfortunately, this styling is
224 output-specific, so we have to do it separately for FO and HTML output. -->
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"/>
233 <xsl:variable name="type">
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 -->
243 <xsl:text>Unexpected numeration: </xsl:text>
244 <xsl:value-of select="$numeration"/>
246 <xsl:value-of select="1."/>
251 <xsl:variable name="item-number">
252 <xsl:call-template name="orderedlist-item-number"/>
255 <xsl:if test="parent::orderedlist/@inheritnum='inherit'
256 and ancestor::listitem[parent::orderedlist]">
257 <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]"
261 <xsl:number value="$item-number" format="{$type}"/>