3eb6c459554f27b66236cbeed10e708823b28aaa
[exim.git] / doc / doc-docbook / MyStyle-fo.xsl
1 <!-- $Cambridge: exim/doc/doc-docbook/MyStyle-fo.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"
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
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.
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
24 <!-- Allow for typed index entries. The "role" setting works with DocBook
25 version 4.2 or earlier. Later versions (which we are not currently using)
26 need "type". -->
27
28 <xsl:param name="index.on.type" select="1"></xsl:param>
29 <xsl:param name="index.on.role" select="1"></xsl:param>
30
31
32 <!-- The default uses short chapter titles in the TOC! I want them only for
33 use in footer lines. So we have to modify this template. I changed
34 "titleabbrev.markup" to "title.markup". While I'm here, I also made chapter
35 entries print in bold. -->
36
37 <xsl:template name="toc.line">
38   <xsl:variable name="id">
39     <xsl:call-template name="object.id"/>
40   </xsl:variable>
41
42   <xsl:variable name="label">
43     <xsl:apply-templates select="." mode="label.markup"/>
44   </xsl:variable>
45
46   <fo:block text-align-last="justify"
47             end-indent="{$toc.indent.width}pt"
48             last-line-end-indent="-{$toc.indent.width}pt">
49     <fo:inline keep-with-next.within-line="always">
50       <!-- Added lines for bold -->
51       <xsl:choose>
52         <xsl:when test="self::chapter">
53           <xsl:attribute name="font-weight">bold</xsl:attribute>
54         </xsl:when>
55         <xsl:when test="self::index">
56           <xsl:attribute name="font-weight">bold</xsl:attribute>
57         </xsl:when>
58       </xsl:choose>
59       <!--  ..................  -->
60       <fo:basic-link internal-destination="{$id}">
61         <xsl:if test="$label != ''">
62           <xsl:copy-of select="$label"/>
63           <xsl:value-of select="$autotoc.label.separator"/>
64         </xsl:if>
65         <xsl:apply-templates select="." mode="title.markup"/>
66       </fo:basic-link>
67     </fo:inline>
68     <fo:inline keep-together.within-line="always">
69       <xsl:text> </xsl:text>
70       <fo:leader leader-pattern="dots"
71                  leader-pattern-width="3pt"
72                  leader-alignment="reference-area"
73                  keep-with-next.within-line="always"/>
74       <xsl:text> </xsl:text>
75       <fo:basic-link internal-destination="{$id}">
76         <fo:page-number-citation ref-id="{$id}"/>
77       </fo:basic-link>
78     </fo:inline>
79   </fo:block>
80 </xsl:template>
81
82
83 <!--
84 Adjust the sizes of the fonts for titles; the defaults are too gross.
85 -->
86
87 <!-- Level 1 is sect1 level -->
88
89 <xsl:attribute-set name="section.title.level1.properties">
90   <xsl:attribute name="font-size">
91     <xsl:value-of select="$body.font.master * 1.2"></xsl:value-of>
92     <xsl:text>pt</xsl:text>
93   </xsl:attribute>
94 </xsl:attribute-set>
95
96
97 <!-- Fiddling with chapter titles is more messy -->
98
99 <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
100   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
101             xsl:use-attribute-sets="chapter.titlepage.recto.style"
102             margin-left="{$title.margin.left}"
103             font-size="17pt"
104             font-weight="bold"
105             font-family="{$title.font.family}">
106     <xsl:call-template name="component.title">
107       <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
108     </xsl:call-template>
109   </fo:block>
110 </xsl:template>
111
112 <xsl:template match="title" mode="chapter.titlepage.verso.auto.mode">
113   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
114             xsl:use-attribute-sets="chapter.titlepage.recto.style"
115             margin-left="{$title.margin.left}"
116             font-size="17pt"
117             font-weight="bold"
118             font-family="{$title.font.family}">
119     <xsl:call-template name="component.title">
120       <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
121     </xsl:call-template>
122   </fo:block>
123 </xsl:template>
124
125
126 <!-- This provides a hard pagebreak mechanism as a get-out -->
127
128 <xsl:template match="processing-instruction('hard-pagebreak')">
129   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
130   </fo:block>
131 </xsl:template>
132
133
134 <!-- Sort out the footer. Useful information is available at
135 http://www.sagehill.net/docbookxsl/PrintHeaders.html
136 -->
137
138
139 <xsl:attribute-set name="footer.content.properties">
140   <!-- <xsl:attribute name="font-family">serif</xsl:attribute> -->
141   <!-- <xsl:attribute name="font-size">9pt</xsl:attribute> -->
142   <xsl:attribute name="font-style">italic</xsl:attribute>
143 </xsl:attribute-set>
144
145
146 <!-- Things that can be inserted into the footer are:
147
148 <fo:page-number/>
149 Inserts the current page number.
150
151 <xsl:apply-templates select="." mode="title.markup"/>
152 Inserts the title of the current chapter, appendix, or other component.
153
154 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
155 Inserts the titleabbrev of the current chapter, appendix, or other component,
156 if it is available. Otherwise it inserts the regular title.
157
158 <xsl:apply-templates select="." mode="object.title.markup"/>
159 Inserts the chapter title with chapter number label. Likewise for appendices.
160
161 <fo:retrieve-marker ... />      Used to retrieve the current section name.
162
163 <xsl:apply-templates select="//corpauthor[1]"/>
164 Inserts the value of the first corpauthor element found anywhere in the
165 document.
166
167 <xsl:call-template name="datetime.format">
168   <xsl:with-param ...
169 Inserts a date timestamp.
170
171 <xsl:call-template name="draft.text"/>
172 Inserts the Draft message if draft.mode is currently on.
173
174 <fo:external-graphic ... />
175 Inserts a graphical image.
176 See the section Graphic in header or footer for details.
177 -->
178
179
180 <xsl:template name="footer.content">
181   <xsl:param name="pageclass" select="''"/>
182   <xsl:param name="sequence" select="''"/>
183   <xsl:param name="position" select="''"/>
184   <xsl:param name="gentext-key" select="''"/>
185
186   <fo:block>
187     <!-- pageclass can be front, body, back -->
188     <!-- sequence can be odd, even, first, blank -->
189     <!-- position can be left, center, right -->
190     <xsl:choose>
191       <xsl:when test="$pageclass = 'titlepage'">
192         <!-- nop; no footer on title pages -->
193       </xsl:when>
194
195       <xsl:when test="$double.sided != 0 and $sequence = 'even'
196                       and $position='left'">
197         <fo:page-number/>
198       </xsl:when>
199
200       <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
201                       and $position='right'">
202         <fo:page-number/>
203       </xsl:when>
204
205       <xsl:when test="$double.sided = 0 and $position='center'">
206         <fo:page-number/>
207       </xsl:when>
208
209       <xsl:when test="$double.sided = 0 and $position='right'">
210         <xsl:apply-templates select="." mode="titleabbrev.markup"/>
211       </xsl:when>
212
213       <xsl:when test="$sequence='blank'">
214         <xsl:choose>
215           <xsl:when test="$double.sided != 0 and $position = 'left'">
216             <fo:page-number/>
217           </xsl:when>
218           <xsl:when test="$double.sided = 0 and $position = 'center'">
219             <fo:page-number/>
220           </xsl:when>
221           <xsl:otherwise>
222             <!-- nop -->
223           </xsl:otherwise>
224         </xsl:choose>
225       </xsl:when>
226
227       <xsl:otherwise>
228         <!-- nop -->
229       </xsl:otherwise>
230     </xsl:choose>
231   </fo:block>
232 </xsl:template>
233
234 </xsl:stylesheet>