1 <?xml version=
"1.0" encoding=
"UTF-8"?> <!-- -*- sgml -*- -->
2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
3 xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" version=
"1.0">
5 <xsl:import href=
"http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
6 <xsl:import href=
"bz-common.xsl"/>
8 <!-- set indent = yes while debugging, then change to NO -->
9 <xsl:output method=
"xml" indent=
"yes"/>
11 <!-- ensure only passivetex extensions are on -->
12 <xsl:param name=
"stylesheet.result.type" select=
"'fo'"/>
13 <!-- fo extensions: PDF bookmarks and index terms -->
14 <xsl:param name=
"use.extensions" select=
"'1'"/>
15 <xsl:param name=
"xep.extensions" select=
"0"/>
16 <xsl:param name=
"fop.extensions" select=
"0"/>
17 <xsl:param name=
"saxon.extensions" select=
"0"/>
18 <xsl:param name=
"passivetex.extensions" select=
"1"/>
19 <xsl:param name=
"tablecolumns.extension" select=
"'1'"/>
21 <!-- ensure we are using single sided -->
22 <xsl:param name=
"double.sided" select=
"'0'"/>
24 <!-- insert cross references to page numbers -->
25 <xsl:param name=
"insert.xref.page.number" select=
"1"/>
27 <!-- <?custom-pagebreak?> inserts a page break at this point -->
28 <xsl:template match=
"processing-instruction('custom-pagebreak')">
29 <fo:block break-before='page'
/>
32 <!-- show links in color -->
33 <xsl:attribute-set name=
"xref.properties">
34 <xsl:attribute name=
"color">blue
</xsl:attribute>
37 <!-- make pre listings indented a bit + a bg colour -->
38 <xsl:template match=
"programlisting | screen">
39 <fo:block start-indent=
"0.25in" wrap-option=
"no-wrap"
40 white-space-collapse=
"false" text-align=
"start"
41 font-family=
"monospace" background-color=
"#f2f2f9"
42 linefeed-treatment=
"preserve"
43 xsl:
use-attribute-sets=
"normal.para.spacing">
44 <xsl:apply-templates/>
47 <!-- make verbatim output prettier -->
48 <xsl:template match=
"literallayout">
49 <fo:block start-indent=
"0.25in" wrap-option=
"no-wrap"
50 white-space-collapse=
"false" text-align=
"start"
51 font-family=
"monospace" background-color=
"#edf7f4"
52 linefeed-treatment=
"preserve"
53 space-before=
"0em" space-after=
"0em">
54 <xsl:apply-templates/>
58 <!-- workaround bug in passivetex fo output for itemizedlist -->
59 <xsl:template match=
"itemizedlist/listitem">
60 <xsl:variable name=
"id">
61 <xsl:call-template name=
"object.id"/></xsl:variable>
62 <xsl:variable name=
"itemsymbol">
63 <xsl:call-template name=
"list.itemsymbol">
64 <xsl:with-param name=
"node" select=
"parent::itemizedlist"/>
67 <xsl:variable name=
"item.contents">
68 <fo:list-item-label end-indent=
"label-end()">
71 <xsl:when test=
"$itemsymbol='disc'">•</xsl:when>
72 <xsl:when test=
"$itemsymbol='bullet'">•</xsl:when>
73 <xsl:otherwise>•</xsl:otherwise>
77 <fo:list-item-body start-indent=
"body-start()">
78 <xsl:apply-templates/> <!-- removed extra block wrapper -->
82 <xsl:when test=
"parent::*/@spacing = 'compact'">
83 <fo:list-item id=
"{$id}"
84 xsl:
use-attribute-sets=
"compact.list.item.spacing">
85 <xsl:copy-of select=
"$item.contents"/>
89 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"list.item.spacing">
90 <xsl:copy-of select=
"$item.contents"/>
96 <!-- workaround bug in passivetex fo output for orderedlist -->
97 <xsl:template match=
"orderedlist/listitem">
98 <xsl:variable name=
"id">
99 <xsl:call-template name=
"object.id"/></xsl:variable>
100 <xsl:variable name=
"item.contents">
101 <fo:list-item-label end-indent=
"label-end()">
103 <xsl:apply-templates select=
"." mode=
"item-number"/>
105 </fo:list-item-label>
106 <fo:list-item-body start-indent=
"body-start()">
107 <xsl:apply-templates/> <!-- removed extra block wrapper -->
111 <xsl:when test=
"parent::*/@spacing = 'compact'">
112 <fo:list-item id=
"{$id}"
113 xsl:
use-attribute-sets=
"compact.list.item.spacing">
114 <xsl:copy-of select=
"$item.contents"/>
118 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"list.item.spacing">
119 <xsl:copy-of select=
"$item.contents"/>
125 <!-- workaround bug in passivetex fo output for variablelist -->
126 <xsl:param name=
"variablelist.as.blocks" select=
"1"/>
127 <xsl:template match=
"varlistentry" mode=
"vl.as.blocks">
128 <xsl:variable name=
"id">
129 <xsl:call-template name=
"object.id"/></xsl:variable>
130 <fo:block id=
"{$id}" xsl:
use-attribute-sets=
"list.item.spacing"
131 keep-together.
within-column=
"always"
132 keep-with-next.
within-column=
"always">
133 <xsl:apply-templates select=
"term"/>
135 <fo:block start-indent=
"0.5in" end-indent=
"0in"
136 space-after.
minimum=
"0.2em"
137 space-after.
optimum=
"0.4em"
138 space-after.
maximum=
"0.6em">
140 <xsl:apply-templates select=
"listitem"/>
146 <!-- workaround bug in footers: force right-align w/two 80|30 cols -->
147 <xsl:template name=
"footer.table">
148 <xsl:param name=
"pageclass" select=
"''"/>
149 <xsl:param name=
"sequence" select=
"''"/>
150 <xsl:param name=
"gentext-key" select=
"''"/>
152 <xsl:when test=
"$pageclass = 'index'">
153 <xsl:attribute name=
"margin-left">0pt
</xsl:attribute>
156 <xsl:variable name=
"candidate">
157 <fo:table table-layout=
"fixed" width=
"100%">
158 <fo:table-column column-number=
"1" column-width=
"80%"/>
159 <fo:table-column column-number=
"2" column-width=
"20%"/>
161 <fo:table-row height=
"14pt">
162 <fo:table-cell text-align=
"left" display-align=
"after">
163 <xsl:attribute name=
"relative-align">baseline
</xsl:attribute>
165 <fo:block> </fo:block><!-- empty cell -->
168 <fo:table-cell text-align=
"center" display-align=
"after">
169 <xsl:attribute name=
"relative-align">baseline
</xsl:attribute>
171 <xsl:call-template name=
"footer.content">
172 <xsl:with-param name=
"pageclass" select=
"$pageclass"/>
173 <xsl:with-param name=
"sequence" select=
"$sequence"/>
174 <xsl:with-param name=
"position" select=
"'center'"/>
175 <xsl:with-param name=
"gentext-key" select=
"$gentext-key"/>
183 <!-- Really output a footer? -->
185 <xsl:when test=
"$pageclass='titlepage' and $gentext-key='book'
186 and $sequence='first'">
187 <!-- no, book titlepages have no footers at all -->
189 <xsl:when test=
"$sequence = 'blank' and $footers.on.blank.pages = 0">
193 <xsl:copy-of select=
"$candidate"/>
199 <!-- fix bug in headers: force right-align w/two 40|60 cols -->
200 <xsl:template name=
"header.table">
201 <xsl:param name=
"pageclass" select=
"''"/>
202 <xsl:param name=
"sequence" select=
"''"/>
203 <xsl:param name=
"gentext-key" select=
"''"/>
205 <xsl:when test=
"$pageclass = 'index'">
206 <xsl:attribute name=
"margin-left">0pt
</xsl:attribute>
209 <xsl:variable name=
"candidate">
210 <fo:table table-layout=
"fixed" width=
"100%">
211 <xsl:call-template name=
"head.sep.rule">
212 <xsl:with-param name=
"pageclass" select=
"$pageclass"/>
213 <xsl:with-param name=
"sequence" select=
"$sequence"/>
214 <xsl:with-param name=
"gentext-key" select=
"$gentext-key"/>
216 <fo:table-column column-number=
"1" column-width=
"40%"/>
217 <fo:table-column column-number=
"2" column-width=
"60%"/>
219 <fo:table-row height=
"14pt">
220 <fo:table-cell text-align=
"left" display-align=
"before">
221 <xsl:attribute name=
"relative-align">baseline
</xsl:attribute>
223 <fo:block> </fo:block><!-- empty cell -->
226 <fo:table-cell text-align=
"center" display-align=
"before">
227 <xsl:attribute name=
"relative-align">baseline
</xsl:attribute>
229 <xsl:call-template name=
"header.content">
230 <xsl:with-param name=
"pageclass" select=
"$pageclass"/>
231 <xsl:with-param name=
"sequence" select=
"$sequence"/>
232 <xsl:with-param name=
"position" select=
"'center'"/>
233 <xsl:with-param name=
"gentext-key" select=
"$gentext-key"/>
241 <!-- Really output a header? -->
243 <xsl:when test=
"$pageclass = 'titlepage' and $gentext-key = 'book'
244 and $sequence='first'">
245 <!-- no, book titlepages have no headers at all -->
247 <xsl:when test=
"$sequence = 'blank' and $headers.on.blank.pages = 0">
251 <xsl:copy-of select=
"$candidate"/>
257 <!-- Bug-fix for Suse 10 PassiveTex version -->
258 <!-- Precompute attribute values 'cos PassiveTex is too stupid: -->
259 <xsl:attribute-set name=
"component.title.properties">
260 <xsl:attribute name=
"keep-with-next.within-column">always
</xsl:attribute>
261 <xsl:attribute name=
"space-before.optimum">
262 <xsl:value-of select=
"concat($body.font.master, 'pt')"/>
264 <xsl:attribute name=
"space-before.minimum">
265 <xsl:value-of select=
"$body.font.master * 0.8"/>
266 <xsl:text>pt
</xsl:text>
268 <xsl:attribute name=
"space-before.maximum">
269 <xsl:value-of select=
"$body.font.master * 1.2"/>
270 <xsl:text>pt
</xsl:text>
272 <xsl:attribute name=
"hyphenate">false
</xsl:attribute>