Install all the files that comprise the new DocBook way of making the
[exim.git] / doc / doc-docbook / MyStyle-fo.xsl
1 <!-- $Cambridge: exim/doc/doc-docbook/MyStyle-fo.xsl,v 1.1 2005/06/16 10:32:31 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
85
86
87
88 <!--
89 Adjust the sizes of the fonts for titles; the defaults are too gross.
90 -->
91
92 <!-- Level 1 is sect1 level -->
93
94 <xsl:attribute-set name="section.title.level1.properties">
95   <xsl:attribute name="font-size">
96     <xsl:value-of select="$body.font.master * 1.2"></xsl:value-of>
97     <xsl:text>pt</xsl:text>
98   </xsl:attribute>
99 </xsl:attribute-set>
100
101
102 <!-- Fiddling with chapter titles is more messy -->
103
104 <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
105   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
106             xsl:use-attribute-sets="chapter.titlepage.recto.style"
107             margin-left="{$title.margin.left}"
108             font-size="17pt"
109             font-weight="bold"
110             font-family="{$title.font.family}">
111     <xsl:call-template name="component.title">
112       <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
113     </xsl:call-template>
114   </fo:block>
115 </xsl:template>
116
117 <xsl:template match="title" mode="chapter.titlepage.verso.auto.mode">
118   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
119             xsl:use-attribute-sets="chapter.titlepage.recto.style"
120             margin-left="{$title.margin.left}"
121             font-size="17pt"
122             font-weight="bold"
123             font-family="{$title.font.family}">
124     <xsl:call-template name="component.title">
125       <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
126     </xsl:call-template>
127   </fo:block>
128 </xsl:template>
129
130
131 <!-- This provides a hard pagebreak mechanism as a get-out -->
132
133 <xsl:template match="processing-instruction('hard-pagebreak')">
134   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-before='page'>
135   </fo:block>
136 </xsl:template>
137
138
139 <!-- Sort out the footer. Useful information is available at
140 http://www.sagehill.net/docbookxsl/PrintHeaders.html
141 -->
142
143
144 <xsl:attribute-set name="footer.content.properties">
145   <!-- <xsl:attribute name="font-family">serif</xsl:attribute> -->
146   <!-- <xsl:attribute name="font-size">9pt</xsl:attribute> -->
147   <xsl:attribute name="font-style">italic</xsl:attribute>
148 </xsl:attribute-set>
149
150
151
152
153 <!-- Things that can be inserted into the footer are:
154
155 <fo:page-number/>
156 Inserts the current page number.
157
158 <xsl:apply-templates select="." mode="title.markup"/>
159 Inserts the title of the current chapter, appendix, or other component.
160
161 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
162 Inserts the titleabbrev of the current chapter, appendix, or other component,
163 if it is available. Otherwise it inserts the regular title.
164
165 <xsl:apply-templates select="." mode="object.title.markup"/>
166 Inserts the chapter title with chapter number label. Likewise for appendices.
167
168 <fo:retrieve-marker ... />      Used to retrieve the current section name.
169
170 <xsl:apply-templates select="//corpauthor[1]"/>
171 Inserts the value of the first corpauthor element found anywhere in the
172 document.
173
174 <xsl:call-template name="datetime.format">
175   <xsl:with-param ...
176 Inserts a date timestamp.
177
178 <xsl:call-template name="draft.text"/>
179 Inserts the Draft message if draft.mode is currently on.
180
181 <fo:external-graphic ... />
182 Inserts a graphical image.
183 See the section Graphic in header or footer for details.
184 -->
185
186
187 <xsl:template name="footer.content">
188   <xsl:param name="pageclass" select="''"/>
189   <xsl:param name="sequence" select="''"/>
190   <xsl:param name="position" select="''"/>
191   <xsl:param name="gentext-key" select="''"/>
192
193   <fo:block>
194     <!-- pageclass can be front, body, back -->
195     <!-- sequence can be odd, even, first, blank -->
196     <!-- position can be left, center, right -->
197     <xsl:choose>
198       <xsl:when test="$pageclass = 'titlepage'">
199         <!-- nop; no footer on title pages -->
200       </xsl:when>
201
202       <xsl:when test="$double.sided != 0 and $sequence = 'even'
203                       and $position='left'">
204         <fo:page-number/>
205       </xsl:when>
206
207       <xsl:when test="$double.sided != 0 and ($sequence = 'odd' or $sequence = 'first')
208                       and $position='right'">
209         <fo:page-number/>
210       </xsl:when>
211
212       <xsl:when test="$double.sided = 0 and $position='center'">
213         <fo:page-number/>
214       </xsl:when>
215
216       <xsl:when test="$double.sided = 0 and $position='right'">
217         <xsl:apply-templates select="." mode="titleabbrev.markup"/>
218       </xsl:when>
219
220       <xsl:when test="$sequence='blank'">
221         <xsl:choose>
222           <xsl:when test="$double.sided != 0 and $position = 'left'">
223             <fo:page-number/>
224           </xsl:when>
225           <xsl:when test="$double.sided = 0 and $position = 'center'">
226             <fo:page-number/>
227           </xsl:when>
228           <xsl:otherwise>
229             <!-- nop -->
230           </xsl:otherwise>
231         </xsl:choose>
232       </xsl:when>
233
234       <xsl:otherwise>
235         <!-- nop -->
236       </xsl:otherwise>
237     </xsl:choose>
238   </fo:block>
239 </xsl:template>
240
241 </xsl:stylesheet>