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"/>
7 <!-- set indent = yes while debugging, then change to NO -->
8 <xsl:output method=
"xml" indent=
"no"/>
11 <!-- passivetex fo extensions: PDF bookmarks and index terms -->
12 <xsl:param name=
"use.extensions" select=
"'1'"/>
13 <xsl:param name=
"passivetex.extensions" select=
"1"/>
14 <!-- turn draft mode off -->
15 <xsl:param name=
"draft.mode" select=
"'no'"></xsl:param>
16 <!-- be extra sure we are using single sided -->
17 <xsl:param name=
"double.sided" select=
"'0'"/>
18 <!-- output in 'block' mode -->
19 <xsl:param name=
"variablelist.as.blocks" select=
"1"/>
20 <!-- don't show url separately in ulinks -->
21 <xsl:param name=
"ulink.show" select=
"0"/>
22 <!-- control generation of tocs -->
23 <xsl:param name=
"generate.toc">
44 <!-- properties common to html + fo ................................... -->
46 <!-- we like '1.2 Title' -->
47 <xsl:param name=
"section.autolabel" select=
"'1'"/>
48 <xsl:param name=
"section.label.includes.component.label" select=
"'1'"/>
50 <!-- Do not put 'Chapter' at the start of eg 'Chapter 1. Doing This' -->
51 <xsl:param name=
"local.l10n.xml" select=
"document('')"/>
52 <l:i18n xmlns:
l=
"http://docbook.sourceforge.net/xmlns/l10n/1.0">
53 <l:l10n language=
"en">
54 <l:context name=
"title-numbered">
55 <l:template name=
"chapter" text=
"%n. %t"/>
60 <!-- per Bob Stayton: turn off xml:base processing pro tem -->
61 <!-- should hopefully be fixed in next docbook stylesheets release (1.70) -->
62 <!-- ensures correct source paths, eg. images/my_img.png -->
63 <xsl:template match=
"@fileref">
64 <xsl:value-of select=
"."/>
67 <!-- end properties common to html + fo ............................... -->
70 <!-- Bug-fix for Suse 10 PassiveTex version -->
71 <!-- Precompute attribute values 'cos PassiveTex is too stupid: -->
72 <xsl:attribute-set name=
"component.title.properties">
73 <xsl:attribute name=
"keep-with-next.within-column">always
</xsl:attribute>
74 <xsl:attribute name=
"space-before.optimum">
75 <xsl:value-of select=
"concat($body.font.master, 'pt')"/>
77 <xsl:attribute name=
"space-before.minimum">
78 <xsl:value-of select=
"$body.font.master * 0.8"/>
79 <xsl:text>pt
</xsl:text>
81 <xsl:attribute name=
"space-before.maximum">
82 <xsl:value-of select=
"$body.font.master * 1.2"/>
83 <xsl:text>pt
</xsl:text>
85 <xsl:attribute name=
"hyphenate">false
</xsl:attribute>
88 <!-- show links in color -->
89 <xsl:attribute-set name=
"xref.properties">
90 <xsl:attribute name=
"color">blue
</xsl:attribute>
93 <!-- colored background for programlisting and screen -->
94 <!-- setting param shade.verbatim=1 screws up literallayout -->
95 <!-- something chronic, so have to go this route -->
96 <xsl:template match=
"programlisting|screen|synopsis">
97 <xsl:param name=
"suppress-numbers" select=
"'0'"/>
98 <xsl:variable name=
"id"><xsl:call-template name=
"object.id"/></xsl:variable>
99 <xsl:variable name=
"content">
101 <xsl:when test=
"$suppress-numbers = '0'
102 and @linenumbering = 'numbered'
103 and $use.extensions != '0'
104 and $linenumbering.extension != '0'">
105 <xsl:call-template name=
"number.rtf.lines">
106 <xsl:with-param name=
"rtf">
107 <xsl:apply-templates/>
112 <xsl:apply-templates/>
116 <fo:block id=
"{$id}" white-space-collapse='false' white-space-treatment='preserve'
117 linefeed-treatment=
"preserve" background-color=
"#f2f2f9"
118 xsl:
use-attribute-sets=
"monospace.verbatim.properties">
120 <xsl:when test=
"$hyphenate.verbatim != 0
121 and function-available('exsl:node-set')">
122 <xsl:apply-templates select=
"exsl:node-set($content)"
123 mode=
"hyphenate.verbatim"/>
126 <xsl:copy-of select=
"$content"/>
133 <!-- customised set title-page template -->
134 <xsl:template name=
"set.titlepage">
135 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format">
136 <xsl:variable name=
"recto.content">
137 <xsl:apply-templates mode=
"set.titlepage.recto.auto.mode"
138 select=
"setinfo/title"/>
139 <xsl:apply-templates mode=
"set.titlepage.recto.auto.mode"
140 select=
"setinfo/releaseinfo"/>
141 <xsl:apply-templates mode=
"set.titlepage.recto.auto.mode"
142 select=
"setinfo/copyright"/>
143 <xsl:apply-templates mode=
"set.titlepage.recto.auto.mode"
144 select=
"setinfo/legalnotice"/>
146 <xsl:variable name=
"recto.elements.count" select=
"1"/>
148 <xsl:copy-of select=
"$recto.content"/>
150 <xsl:call-template name=
"set.titlepage.separator"/>
154 <!-- put some extra space after the set title -->
155 <xsl:template match=
"title" mode=
"set.titlepage.recto.auto.mode">
156 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format"
157 xsl:
use-attribute-sets=
"set.titlepage.recto.style"
158 text-align=
"center" font-size=
"24.8832pt" space-before=
"18.6624pt"
159 space-after=
"18.6624pt" font-weight=
"bold" font-family=
"{$title.fontset}">
160 <xsl:call-template name=
"division.title">
161 <xsl:with-param name=
"node" select=
"ancestor-or-self::set[1]"/>
166 <!-- put release-info + copyright centered and bold -->
167 <xsl:template match=
"releaseinfo" mode=
"set.titlepage.recto.auto.mode">
168 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
169 font-size=
"14pt" font-weight=
"bold" font-family=
"{$title.fontset}">
170 <xsl:apply-templates select=
"." mode=
"set.titlepage.recto.mode"/>
174 <xsl:template match=
"copyright" mode=
"set.titlepage.recto.auto.mode">
175 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
176 font-size=
"12pt" font-weight=
"bold" font-family=
"{$title.fontset}">
177 <xsl:apply-templates select=
"." mode=
"set.titlepage.recto.mode"/>
182 <!-- customised book title-page template -->
183 <xsl:template name=
"book.titlepage">
184 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format">
185 <xsl:variable name=
"recto.content">
186 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
187 select=
"bookinfo/title"/>
188 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
189 select=
"bookinfo/subtitle"/>
190 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
191 select=
"bookinfo/releaseinfo"/>
192 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
193 select=
"bookinfo/copyright"/>
194 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
195 select=
"bookinfo/author"/>
196 <xsl:apply-templates mode=
"book.titlepage.recto.auto.mode"
197 select=
"bookinfo/legalnotice"/>
199 <xsl:variable name=
"recto.elements.count" select=
"1"/>
201 <xsl:copy-of select=
"$recto.content"/>
203 <xsl:call-template name=
"book.titlepage.separator"/>
207 <!-- put some extra space after the book title -->
208 <xsl:template match=
"title" mode=
"book.titlepage.recto.auto.mode">
209 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format"
210 xsl:
use-attribute-sets=
"book.titlepage.recto.style"
211 text-align=
"center" font-size=
"24.8832pt" space-before=
"18.6624pt"
212 space-after=
"18.6624pt" font-weight=
"bold" font-family=
"{$title.fontset}">
213 <xsl:call-template name=
"division.title">
214 <xsl:with-param name=
"node" select=
"ancestor-or-self::book[1]"/>
219 <!-- center subtitles -->
220 <xsl:template match=
"subtitle" mode=
"book.titlepage.recto.auto.mode">
221 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
222 font-size=
"14pt" font-weight=
"bold" font-family=
"{$title.fontset}">
223 <xsl:apply-templates select=
"." mode=
"book.titlepage.recto.mode"/>
227 <!-- no docbook template for bookinfo/releaseinfo, so make one -->
228 <xsl:template match=
"releaseinfo" mode=
"book.titlepage.recto.auto.mode">
229 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
230 font-size=
"12pt" font-weight=
"bold" font-family=
"{$title.fontset}">
231 <xsl:apply-templates select=
"." mode=
"book.titlepage.recto.mode"/>
235 <!-- no docbook recto template for bookinfo/copyright, so make one -->
236 <xsl:template match=
"copyright" mode=
"book.titlepage.recto.auto.mode">
237 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
238 font-size=
"11pt" font-weight=
"bold" font-family=
"{$title.fontset}">
239 <xsl:apply-templates select=
"." mode=
"book.titlepage.recto.mode"/>
243 <!-- customised email for titlepages -->
244 <xsl:template match=
"author" mode=
"book.titlepage.recto.auto.mode">
245 <fo:block xmlns:
fo=
"http://www.w3.org/1999/XSL/Format" text-align=
"center"
246 font-size=
"10pt" font-family=
"{$title.fontset}">
247 <xsl:if test=
"email">
248 <xsl:text>Email:
</xsl:text>
249 <xsl:apply-templates select=
"(email)[1]"/>
255 <!-- show only book titles in the top-level set toc -->
256 <xsl:template match=
"book|setindex" mode=
"toc">
257 <xsl:param name=
"toc-context" select=
"."/>
258 <xsl:variable name=
"id">
259 <xsl:call-template name=
"object.id"/>
261 <xsl:variable name=
"cid">
262 <xsl:call-template name=
"object.id">
263 <xsl:with-param name=
"object" select=
"$toc-context"/>
266 <xsl:call-template name=
"toc.line"/>
267 <xsl:variable name=
"nodes" select=
"glossary|bibliography|preface|chapter
268 |reference|part|article|appendix|index"/>
269 <xsl:variable name=
"depth.from.context"
270 select=
"count(ancestor::*)-count($toc-context/ancestor::*)"/>
271 <xsl:if test=
"$toc.section.depth > 0 and not($toc-context/self::set)
272 and $toc.max.depth > $depth.from.context and $nodes">
273 <fo:block id=
"toc.{$cid}.{$id}">
274 <xsl:attribute name=
"margin-left">
275 <xsl:call-template name=
"set.toc.indent"/>
277 <xsl:apply-templates select=
"$nodes" mode=
"toc">
278 <xsl:with-param name=
"toc-context" select=
"$toc-context"/>
279 </xsl:apply-templates>
285 <!-- TODO: don`t generate a TOC at all for Quick-Start and FAQ -->
289 <!-- page headers: -->
290 <xsl:template name=
"header.table">
291 <xsl:param name=
"pageclass" select=
"''"/>
292 <xsl:param name=
"sequence" select=
"''"/>
293 <xsl:param name=
"gentext-key" select=
"''"/>
294 <xsl:variable name=
"candidate">
295 <fo:table table-layout=
"fixed" width=
"100%" border-bottom-width=
"0.5pt" border-bottom-style=
"solid" border-bottom-color=
"black">
296 <fo:table-column column-number=
"1" column-width=
"100%"/>
298 <fo:table-row height=
"14pt">
299 <fo:table-cell text-align=
"right" display-align=
"before" relative-align=
"baseline">
301 <xsl:apply-templates select=
"." mode=
"titleabbrev.markup"/>
309 <xsl:when test=
"$pageclass='titlepage' or $sequence='blank'
310 or ($sequence='first' and $gentext-key='chapter')">
311 <!-- noop on titlepages, first chapter page or blank pages -->
314 <xsl:copy-of select=
"$candidate"/>
321 <!-- page footers: two 80|20 cols w/right-aligned page numbers -->
322 <xsl:template name=
"footer.table">
323 <xsl:param name=
"pageclass" select=
"''"/>
324 <xsl:param name=
"sequence" select=
"''"/>
325 <xsl:param name=
"gentext-key" select=
"''"/>
326 <xsl:variable name=
"candidate">
327 <fo:table table-layout=
"fixed" width=
"100%">
328 <fo:table-column column-number=
"1" column-width=
"80%"/>
329 <fo:table-column column-number=
"2" column-width=
"20%"/>
331 <fo:table-row height=
"14pt">
332 <fo:table-cell text-align=
"left" display-align=
"after"
333 relative-align=
"baseline">
337 <xsl:text>Pageclass: </xsl:text>
338 <xsl:value-of select="$pageclass"/>
339 <xsl:text> Sequence: </xsl:text>
340 <xsl:value-of select="$sequence"/>
341 <xsl:text> Gentext-Key: </xsl:text>
342 <xsl:value-of select="$gentext-key"/>
346 <fo:table-cell text-align=
"right" display-align=
"after"
347 relative-align=
"baseline">
357 <xsl:when test=
"$pageclass='titlepage' or $sequence='blank'">
358 <!-- noop on titlepages or blank pages -->
361 <xsl:copy-of select=
"$candidate"/>
367 <!-- workaround bug in passivetex fo output for itemizedlist -->
368 <xsl:template match=
"itemizedlist/listitem">
369 <xsl:variable name=
"id"><xsl:call-template name=
"object.id"/></xsl:variable>
370 <xsl:variable name=
"item.contents">
371 <fo:list-item-label end-indent=
"label-end()">
373 <xsl:call-template name=
"itemizedlist.label.markup">
374 <xsl:with-param name=
"itemsymbol">
375 <xsl:call-template name=
"list.itemsymbol">
376 <xsl:with-param name=
"node" select=
"parent::itemizedlist"/>
381 </fo:list-item-label>
382 <fo:list-item-body start-indent=
"body-start()">
383 <xsl:apply-templates/> <!-- removed extra block wrapper -->
387 <xsl:when test=
"parent::*/@spacing = 'compact'">
388 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"compact.list.item.spacing">
389 <xsl:copy-of select=
"$item.contents"/>
393 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"list.item.spacing">
394 <xsl:copy-of select=
"$item.contents"/>
400 <!-- workaround bug in passivetex fo output for orderedlist -->
401 <xsl:template match=
"orderedlist/listitem">
402 <xsl:variable name=
"id"><xsl:call-template name=
"object.id"/></xsl:variable>
403 <xsl:variable name=
"item.contents">
404 <fo:list-item-label end-indent=
"label-end()">
406 <xsl:apply-templates select=
"." mode=
"item-number"/>
408 </fo:list-item-label>
409 <fo:list-item-body start-indent=
"body-start()">
410 <xsl:apply-templates/> <!-- removed extra block wrapper -->
414 <xsl:when test=
"parent::*/@spacing = 'compact'">
415 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"compact.list.item.spacing">
416 <xsl:copy-of select=
"$item.contents"/>
420 <fo:list-item id=
"{$id}" xsl:
use-attribute-sets=
"list.item.spacing">
421 <xsl:copy-of select=
"$item.contents"/>