FreeBSD x86 scalar: update expected after fix for sigwait
[valgrind.git] / docs / lib / vg-fo.xsl
blob30ffa4c6093fea8554303892f387cdc6398593fd
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">
24 set toc,title
25 book toc,title
26 part toc,title
27 chapter nop,title
28 section nop
29 sect1 nop
30 sect2 nop
31 sect3 nop
32 sect4 nop
33 sect5 nop
34 article nop
35 book/article nop
36 article/sect1 nop
37 appendix toc,title
38 preface toc,title
39 reference toc,title
40 qandadiv toc
41 qandaset toc
42 </xsl:param>
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.&#160;%t"/>
56 </l:context>
57 </l:l10n>
58 </l:i18n>
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="."/>
65 </xsl:template>
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')"/>
76 </xsl:attribute>
77 <xsl:attribute name="space-before.minimum">
78 <xsl:value-of select="$body.font.master * 0.8"/>
79 <xsl:text>pt</xsl:text>
80 </xsl:attribute>
81 <xsl:attribute name="space-before.maximum">
82 <xsl:value-of select="$body.font.master * 1.2"/>
83 <xsl:text>pt</xsl:text>
84 </xsl:attribute>
85 <xsl:attribute name="hyphenate">false</xsl:attribute>
86 </xsl:attribute-set>
88 <!-- show links in color -->
89 <xsl:attribute-set name="xref.properties">
90 <xsl:attribute name="color">blue</xsl:attribute>
91 </xsl:attribute-set>
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">
100 <xsl:choose>
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/>
108 </xsl:with-param>
109 </xsl:call-template>
110 </xsl:when>
111 <xsl:otherwise>
112 <xsl:apply-templates/>
113 </xsl:otherwise>
114 </xsl:choose>
115 </xsl:variable>
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">
119 <xsl:choose>
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"/>
124 </xsl:when>
125 <xsl:otherwise>
126 <xsl:copy-of select="$content"/>
127 </xsl:otherwise>
128 </xsl:choose>
129 </fo:block>
130 </xsl:template>
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"/>
145 </xsl:variable>
146 <xsl:variable name="recto.elements.count" select="1"/>
147 <fo:block>
148 <xsl:copy-of select="$recto.content"/>
149 </fo:block>
150 <xsl:call-template name="set.titlepage.separator"/>
151 </fo:block>
152 </xsl:template>
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]"/>
162 </xsl:call-template>
163 </fo:block>
164 </xsl:template>
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"/>
171 </fo:block>
172 </xsl:template>
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"/>
178 </fo:block>
179 </xsl:template>
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"/>
198 </xsl:variable>
199 <xsl:variable name="recto.elements.count" select="1"/>
200 <fo:block>
201 <xsl:copy-of select="$recto.content"/>
202 </fo:block>
203 <xsl:call-template name="book.titlepage.separator"/>
204 </fo:block>
205 </xsl:template>
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]"/>
215 </xsl:call-template>
216 </fo:block>
217 </xsl:template>
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"/>
224 </fo:block>
225 </xsl:template>
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"/>
232 </fo:block>
233 </xsl:template>
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"/>
240 </fo:block>
241 </xsl:template>
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]"/>
250 </xsl:if>
251 </fo:block>
252 </xsl:template>
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"/>
260 </xsl:variable>
261 <xsl:variable name="cid">
262 <xsl:call-template name="object.id">
263 <xsl:with-param name="object" select="$toc-context"/>
264 </xsl:call-template>
265 </xsl:variable>
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"/>
276 </xsl:attribute>
277 <xsl:apply-templates select="$nodes" mode="toc">
278 <xsl:with-param name="toc-context" select="$toc-context"/>
279 </xsl:apply-templates>
280 </fo:block>
281 </xsl:if>
282 </xsl:template>
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%"/>
297 <fo:table-body>
298 <fo:table-row height="14pt">
299 <fo:table-cell text-align="right" display-align="before" relative-align="baseline">
300 <fo:block>
301 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
302 </fo:block>
303 </fo:table-cell>
304 </fo:table-row>
305 </fo:table-body>
306 </fo:table>
307 </xsl:variable>
308 <xsl:choose>
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 -->
312 </xsl:when>
313 <xsl:otherwise>
314 <xsl:copy-of select="$candidate"/>
315 </xsl:otherwise>
316 </xsl:choose>
317 </xsl:template>
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%"/>
330 <fo:table-body>
331 <fo:table-row height="14pt">
332 <fo:table-cell text-align="left" display-align="after"
333 relative-align="baseline">
334 <fo:block/>
335 <!--
336 <fo:block>
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"/>
343 </fo:block>
345 </fo:table-cell>
346 <fo:table-cell text-align="right" display-align="after"
347 relative-align="baseline">
348 <fo:block>
349 <fo:page-number/>
350 </fo:block>
351 </fo:table-cell>
352 </fo:table-row>
353 </fo:table-body>
354 </fo:table>
355 </xsl:variable>
356 <xsl:choose>
357 <xsl:when test="$pageclass='titlepage' or $sequence='blank'">
358 <!-- noop on titlepages or blank pages -->
359 </xsl:when>
360 <xsl:otherwise>
361 <xsl:copy-of select="$candidate"/>
362 </xsl:otherwise>
363 </xsl:choose>
364 </xsl:template>
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()">
372 <fo:block>
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"/>
377 </xsl:call-template>
378 </xsl:with-param>
379 </xsl:call-template>
380 </fo:block>
381 </fo:list-item-label>
382 <fo:list-item-body start-indent="body-start()">
383 <xsl:apply-templates/> <!-- removed extra block wrapper -->
384 </fo:list-item-body>
385 </xsl:variable>
386 <xsl:choose>
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"/>
390 </fo:list-item>
391 </xsl:when>
392 <xsl:otherwise>
393 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
394 <xsl:copy-of select="$item.contents"/>
395 </fo:list-item>
396 </xsl:otherwise>
397 </xsl:choose>
398 </xsl:template>
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()">
405 <fo:block>
406 <xsl:apply-templates select="." mode="item-number"/>
407 </fo:block>
408 </fo:list-item-label>
409 <fo:list-item-body start-indent="body-start()">
410 <xsl:apply-templates/> <!-- removed extra block wrapper -->
411 </fo:list-item-body>
412 </xsl:variable>
413 <xsl:choose>
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"/>
417 </fo:list-item>
418 </xsl:when>
419 <xsl:otherwise>
420 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
421 <xsl:copy-of select="$item.contents"/>
422 </fo:list-item>
423 </xsl:otherwise>
424 </xsl:choose>
425 </xsl:template>
428 </xsl:stylesheet>