Debian Codegraph @

src/docbkx/styles/reference-pdf.xsl

raw
1 <?xml version="1.0"?>
2 <!--
3 ~ Copyright 2009-2013 Roland Huss
4 ~
5 ~ Licensed under the Apache License, Version 2.0 (the "License");
6 ~ you may not use this file except in compliance with the License.
7 ~ You may obtain a copy of the License at
8 ~
9 ~ http://www.apache.org/licenses/LICENSE-2.0
10 ~
11 ~ Unless required by applicable law or agreed to in writing, software
12 ~ distributed under the License is distributed on an "AS IS" BASIS,
13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ~ See the License for the specific language governing permissions and
15 ~ limitations under the License.
16 -->
17
18 <!--
19 This is the XSL FO (PDF) stylesheet for the Jolokia reference documentation.
20 -->
21
22 <!DOCTYPE xsl:stylesheet [
23 <!ENTITY copyright "&#xA9;">
24 ]>
25
26 <xsl:stylesheet xmlns="http://www.w3.org/TR/xhtml1/transitional"
27 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
28 xmlns:fo="http://www.w3.org/1999/XSL/Format"
29 xmlns:xslthl="http://xslthl.sf.net"
30 version="1.0"
31 exclude-result-prefixes="#default xslthl">
32
33 <xsl:import href="urn:docbkx:stylesheet" />
34
35 <!--###################################################
36 Custom Title Page
37 ################################################### -->
38
39 <xsl:template name="book.titlepage.recto">
40 <fo:block>
41 <fo:table table-layout="fixed" width="175mm">
42 <fo:table-column column-width="175mm"/>
43 <fo:table-body>
44 <fo:table-row>
45 <fo:table-cell text-align="center">
46 <fo:block padding-before="25mm">
47 <fo:external-graphic src="file:images/citrus_logo.png"/>
48 </fo:block>
49 <fo:block font-family="Helvetica" font-size="28pt" padding-before="30mm">
50 <xsl:value-of select="bookinfo/subtitle"/>
51 </fo:block>
52 <fo:block font-family="Helvetica" font-size="28pt" padding="10mm">
53 <xsl:value-of select="bookinfo/title"/>
54 </fo:block>
55 <fo:block font-family="Helvetica" font-size="20pt" padding="10mm">
56 <xsl:text>Version </xsl:text><xsl:value-of select="bookinfo/releaseinfo"/>
57 </fo:block>
58 </fo:table-cell>
59 </fo:table-row>
60 <fo:table-row>
61 <fo:table-cell text-align="center">
62 <fo:block font-family="Helvetica" font-size="20pt" padding="10mm">
63 <xsl:value-of select="bookinfo/pubdate"/>
64 </fo:block>
65 </fo:table-cell>
66 </fo:table-row>
67 <fo:table-row>
68 <fo:table-cell text-align="center">
69 <fo:block font-family="Helvetica" font-size="16pt" padding="10mm">
70 <xsl:text>Copyright &copyright; </xsl:text>
71 <xsl:value-of select="bookinfo/copyright/year"/>
72 <xsl:text> </xsl:text>
73 <xsl:for-each select="bookinfo/copyright/holder">
74 <xsl:if test="position() > 1">
75 <xsl:text>, </xsl:text>
76 </xsl:if>
77 <xsl:value-of select="."/>
78 </xsl:for-each>
79 </fo:block>
80 <fo:block font-family="Helvetica" font-size="12pt" padding="1mm">
81 <xsl:value-of select="bookinfo/legalnotice"/>
82 </fo:block>
83 </fo:table-cell>
84 </fo:table-row>
85 </fo:table-body>
86 </fo:table>
87 </fo:block>
88 </xsl:template>
89
90 <!-- Prevent blank pages in output -->
91 <xsl:template name="book.titlepage.before.verso">
92 </xsl:template>
93 <xsl:template name="book.titlepage.verso">
94 </xsl:template>
95 <xsl:template name="book.titlepage.separator">
96 </xsl:template>
97
98 <!--###################################################
99 Header
100 ################################################### -->
101
102 <!-- More space in the center header for long text -->
103 <xsl:attribute-set name="header.content.properties">
104 <xsl:attribute name="font-family">
105 <xsl:value-of select="$body.font.family"/>
106 </xsl:attribute>
107 <xsl:attribute name="margin-left">-5em</xsl:attribute>
108 <xsl:attribute name="margin-right">-5em</xsl:attribute>
109 </xsl:attribute-set>
110
111 <!--###################################################
112 Custom Footer
113 ################################################### -->
114 <xsl:template name="footer.content">
115 <xsl:param name="pageclass" select="''" />
116 <xsl:param name="sequence" select="''" />
117 <xsl:param name="position" select="''" />
118 <xsl:param name="gentext-key" select="''" />
119 <xsl:variable name="Version">
120 <xsl:if test="//releaseinfo">
121 <xsl:text>Jolokia (</xsl:text><xsl:value-of select="//releaseinfo" /><xsl:text>)</xsl:text>
122 </xsl:if>
123 </xsl:variable>
124 <xsl:choose>
125 <xsl:when test="$sequence='blank'">
126 <xsl:if test="$position = 'center'">
127 <xsl:value-of select="$Version" />
128 </xsl:if>
129 </xsl:when>
130 <!-- for double sided printing, print page numbers on alternating sides (of the page) -->
131 <xsl:when test="$double.sided != 0">
132 <xsl:choose>
133 <xsl:when test="$sequence = 'even' and $position='left'">
134 <fo:page-number />
135 </xsl:when>
136 <xsl:when test="$sequence = 'odd' and $position='right'">
137 <fo:page-number />
138 </xsl:when>
139 <xsl:when test="$position='center'">
140 <xsl:value-of select="$Version" />
141 </xsl:when>
142 </xsl:choose>
143 </xsl:when>
144 <!-- for single sided printing, print all page numbers on the right (of the page) -->
145 <xsl:when test="$double.sided = 0">
146 <xsl:choose>
147 <xsl:when test="$position='center'">
148 <xsl:value-of select="$Version" />
149 </xsl:when>
150 <xsl:when test="$position='right'">
151 <fo:page-number />
152 </xsl:when>
153 </xsl:choose>
154 </xsl:when>
155 </xsl:choose>
156 </xsl:template>
157
158 <!--###################################################
159 Custom Toc Line
160 ################################################### -->
161
162 <!-- The default DocBook XSL TOC printing is seriously broken... -->
163 <xsl:template name="toc.line">
164 <xsl:variable name="id">
165 <xsl:call-template name="object.id"/>
166 </xsl:variable>
167
168 <xsl:variable name="label">
169 <xsl:apply-templates select="." mode="label.markup"/>
170 </xsl:variable>
171
172 <!-- justify-end removed from block attributes (space problem in title.markup) -->
173 <fo:block end-indent="{$toc.indent.width}pt"
174 last-line-end-indent="-{$toc.indent.width}pt"
175 white-space-treatment="ignore"
176 linefeed-treatment="ignore"
177 text-align-last="justify"
178 white-space-collapse="true">
179 <fo:inline keep-with-next.within-line="always">
180 <!-- print Chapters in bold style -->
181 <xsl:choose>
182 <xsl:when test="local-name(.) = 'chapter'">
183 <xsl:attribute name="font-weight">bold</xsl:attribute>
184 </xsl:when>
185 </xsl:choose>
186 <fo:basic-link internal-destination="{$id}">
187 <xsl:if test="$label != ''">
188 <xsl:copy-of select="$label"/>
189 <fo:inline white-space-treatment="ignore"
190 linefeed-treatment="ignore"
191 white-space-collapse="true">
192 <xsl:value-of select="$autotoc.label.separator"/>
193 </fo:inline>
194 </xsl:if>
195 <xsl:apply-templates select="." mode="title.markup"/>
196 </fo:basic-link>
197 </fo:inline>
198 <fo:inline keep-together.within-line="always">
199 <xsl:text> </xsl:text>
200 <fo:leader leader-pattern="dots"
201 leader-pattern-width="6pt"
202 leader-alignment="reference-area"
203 keep-with-next.within-line="always"/>
204 <xsl:text> </xsl:text>
205 <fo:basic-link internal-destination="{$id}">
206 <fo:page-number-citation ref-id="{$id}"/>
207 </fo:basic-link>
208 </fo:inline>
209 </fo:block>
210 </xsl:template>
211
212 <!--###################################################
213 Extensions
214 ################################################### -->
215
216 <!-- These extensions are required for table printing and other stuff -->
217 <xsl:param name="use.extensions">1</xsl:param>
218 <xsl:param name="tablecolumns.extension">0</xsl:param>
219 <xsl:param name="callout.extensions">1</xsl:param>
220 <!-- FOP provide only PDF Bookmarks at the moment -->
221 <xsl:param name="fop.extensions">1</xsl:param>
222
223 <!--###################################################
224 Table Of Contents
225 ################################################### -->
226
227 <!-- Generate the TOCs for named components only -->
228 <xsl:param name="generate.toc">
229 book toc
230 </xsl:param>
231
232 <!-- Show only Sections up to level 3 in the TOCs -->
233 <xsl:param name="toc.section.depth">2</xsl:param>
234
235 <!-- Dot and Whitespace as separator in TOC between Label and Title-->
236 <xsl:param name="autotoc.label.separator" select="'. '"/>
237
238
239 <!--###################################################
240 Paper & Page Size
241 ################################################### -->
242
243 <!-- Paper type, no headers on blank pages, no double sided printing -->
244 <xsl:param name="paper.type" select="'A4'"/>
245 <xsl:param name="double.sided">0</xsl:param>
246 <xsl:param name="headers.on.blank.pages">0</xsl:param>
247 <xsl:param name="footers.on.blank.pages">0</xsl:param>
248
249 <!-- Space between paper border and content (chaotic stuff, don't touch) -->
250 <xsl:param name="page.margin.top">5mm</xsl:param>
251 <xsl:param name="region.before.extent">10mm</xsl:param>
252 <xsl:param name="body.margin.top">10mm</xsl:param>
253
254 <xsl:param name="body.margin.bottom">15mm</xsl:param>
255 <xsl:param name="region.after.extent">10mm</xsl:param>
256 <xsl:param name="page.margin.bottom">0mm</xsl:param>
257
258 <xsl:param name="page.margin.outer">18mm</xsl:param>
259 <xsl:param name="page.margin.inner">18mm</xsl:param>
260
261 <!-- No intendation of Titles -->
262 <xsl:param name="title.margin.left">0pc</xsl:param>
263
264 <!--###################################################
265 Fonts & Styles
266 ################################################### -->
267
268 <!-- Left aligned text and no hyphenation -->
269 <xsl:param name="alignment">justify</xsl:param>
270 <xsl:param name="hyphenate">false</xsl:param>
271
272 <!-- Default Font size -->
273 <xsl:param name="body.font.master">11</xsl:param>
274 <xsl:param name="body.font.small">8</xsl:param>
275 <xsl:param name="body.font.family">Helvetica</xsl:param>
276
277 <!-- Line height in body text -->
278 <xsl:param name="line-height">1.4</xsl:param>
279
280 <!-- Monospaced fonts are smaller than regular text -->
281 <xsl:attribute-set name="monospace.properties">
282 <xsl:attribute name="font-family">
283 <xsl:value-of select="$monospace.font.family"/>
284 </xsl:attribute>
285 <xsl:attribute name="font-size">0.8em</xsl:attribute>
286 </xsl:attribute-set>
287
288 <!--###################################################
289 Tables
290 ################################################### -->
291
292 <!-- The table width should be adapted to the paper size -->
293 <xsl:param name="default.table.width">17.4cm</xsl:param>
294
295 <!-- Some padding inside tables -->
296 <xsl:attribute-set name="table.cell.padding">
297 <xsl:attribute name="padding-left">4pt</xsl:attribute>
298 <xsl:attribute name="padding-right">4pt</xsl:attribute>
299 <xsl:attribute name="padding-top">4pt</xsl:attribute>
300 <xsl:attribute name="padding-bottom">4pt</xsl:attribute>
301 </xsl:attribute-set>
302
303 <!-- Only hairlines as frame and cell borders in tables -->
304 <xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
305 <xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
306
307 <!--###################################################
308 Labels
309 ################################################### -->
310
311 <!-- Label Chapters and Sections (numbering) -->
312 <xsl:param name="chapter.autolabel">1</xsl:param>
313 <xsl:param name="section.autolabel" select="1"/>
314 <xsl:param name="section.label.includes.component.label" select="1"/>
315
316 <!--###################################################
317 Titles
318 ################################################### -->
319
320 <!-- Chapter title size -->
321 <xsl:attribute-set name="chapter.titlepage.recto.style">
322 <xsl:attribute name="text-align">left</xsl:attribute>
323 <xsl:attribute name="font-weight">bold</xsl:attribute>
324 <xsl:attribute name="font-size">
325 <xsl:value-of select="$body.font.master * 1.8"/>
326 <xsl:text>pt</xsl:text>
327 </xsl:attribute>
328 </xsl:attribute-set>
329
330 <!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
331 Let's remove it, so this sucker can use our attribute-set only... -->
332 <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
333 <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
334 xsl:use-attribute-sets="chapter.titlepage.recto.style">
335 <xsl:call-template name="component.title">
336 <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
337 </xsl:call-template>
338 </fo:block>
339 </xsl:template>
340
341 <!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
342 <xsl:attribute-set name="section.title.level1.properties">
343 <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
344 <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
345 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
346 <xsl:attribute name="font-size">
347 <xsl:value-of select="$body.font.master * 1.5"/>
348 <xsl:text>pt</xsl:text>
349 </xsl:attribute>
350 <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
351 <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
352 <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
353 </xsl:attribute-set>
354
355 <xsl:attribute-set name="section.title.level2.properties">
356 <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
357 <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
358 <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
359 <xsl:attribute name="font-size">
360 <xsl:value-of select="$body.font.master * 1.25"/>
361 <xsl:text>pt</xsl:text>
362 </xsl:attribute>
363 <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
364 <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
365 <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
366 </xsl:attribute-set>
367
368 <xsl:attribute-set name="section.title.level3.properties">
369 <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
370 <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
371 <xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
372 <xsl:attribute name="font-size">
373 <xsl:value-of select="$body.font.master * 1.0"/>
374 <xsl:text>pt</xsl:text>
375 </xsl:attribute>
376 <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
377 <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
378 <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
379 </xsl:attribute-set>
380
381 <!-- Titles of formal objects (tables, examples, ...) -->
382 <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
383 <xsl:attribute name="font-weight">bold</xsl:attribute>
384 <xsl:attribute name="font-size">
385 <xsl:value-of select="$body.font.master"/>
386 <xsl:text>pt</xsl:text>
387 </xsl:attribute>
388 <xsl:attribute name="hyphenate">false</xsl:attribute>
389 <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
390 <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
391 <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
392 </xsl:attribute-set>
393
394 <!--###################################################
395 Programlistings
396 ################################################### -->
397
398 <!-- Verbatim text formatting (programlistings) -->
399 <xsl:attribute-set name="monospace.verbatim.properties">
400 <xsl:attribute name="font-family">Courier</xsl:attribute>
401 <xsl:attribute name="font-size">0.9em</xsl:attribute>
402 </xsl:attribute-set>
403
404 <xsl:attribute-set name="verbatim.properties">
405 <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
406 <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
407 <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
408 <xsl:attribute name="border-color">#444444</xsl:attribute>
409 <xsl:attribute name="border-style">solid</xsl:attribute>
410 <xsl:attribute name="border-width">0.1pt</xsl:attribute>
411 <xsl:attribute name="padding-top">0.5em</xsl:attribute>
412 <xsl:attribute name="padding-left">0.5em</xsl:attribute>
413 <xsl:attribute name="padding-right">0.5em</xsl:attribute>
414 <xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
415 <xsl:attribute name="margin-left">0.5em</xsl:attribute>
416 <xsl:attribute name="margin-right">0.5em</xsl:attribute>
417 </xsl:attribute-set>
418
419 <!-- Shade (background) programlistings -->
420 <xsl:param name="shade.verbatim">1</xsl:param>
421 <xsl:attribute-set name="shade.verbatim.style">
422 <xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
423 </xsl:attribute-set>
424
425 <!--###################################################
426 Callouts
427 ################################################### -->
428
429 <!-- Use images for callouts instead of (1) (2) (3) -->
430 <xsl:param name="callout.graphics">1</xsl:param>
431 <xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
432
433 <!-- Place callout marks at this column in annotated areas -->
434 <xsl:param name="callout.defaultcolumn">90</xsl:param>
435
436 <!--###################################################
437 Admonitions
438 ################################################### -->
439
440 <!-- Use nice graphics for admonitions -->
441 <xsl:param name="admon.graphics">'1'</xsl:param>
442 <xsl:param name="admon.graphics.path">images/admons/</xsl:param>
443
444 <!--###################################################
445 Misc
446 ################################################### -->
447
448 <xsl:param name="draft.mode">no</xsl:param>
449
450 <!-- Placement of titles -->
451 <xsl:param name="formal.title.placement">
452 figure after
453 example before
454 equation before
455 table before
456 procedure before
457 </xsl:param>
458
459 <!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
460 <xsl:param name="variablelist.as.blocks">1</xsl:param>
461
462 <!-- The horrible list spacing problems -->
463 <xsl:attribute-set name="list.block.spacing">
464 <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
465 <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
466 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
467 <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
468 <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
469 <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
470 </xsl:attribute-set>
471
472 <!--###################################################
473 colored and hyphenated links
474 ################################################### -->
475
476 <xsl:template match="ulink">
477 <fo:basic-link external-destination="{@url}"
478 xsl:use-attribute-sets="xref.properties"
479 text-decoration="underline"
480 color="blue">
481 <xsl:choose>
482 <xsl:when test="count(child::node())=0">
483 <xsl:value-of select="@url"/>
484 </xsl:when>
485 <xsl:otherwise>
486 <xsl:apply-templates/>
487 </xsl:otherwise>
488 </xsl:choose>
489 </fo:basic-link>
490 </xsl:template>
491
492 <xsl:template match="link">
493 <fo:basic-link internal-destination="{@linkend}"
494 xsl:use-attribute-sets="xref.properties"
495 text-decoration="underline"
496 color="blue">
497 <xsl:choose>
498 <xsl:when test="count(child::node())=0">
499 <xsl:value-of select="@linkend"/>
500 </xsl:when>
501 <xsl:otherwise>
502 <xsl:apply-templates/>
503 </xsl:otherwise>
504 </xsl:choose>
505 </fo:basic-link>
506 </xsl:template>
507
508 <!--###################################################
509 Highlighting
510 ################################################### -->
511
512 <xsl:param name="highlight.source">1</xsl:param>
513 <xsl:param name="highlight.default.language">xml</xsl:param>
514
515 <xsl:template match='xslthl:tag' mode="xslthl">
516 <fo:inline color="teal"><xsl:apply-templates mode="xslthl"/></fo:inline>
517 </xsl:template>
518
519 <xsl:template match='xslthl:attribute' mode="xslthl">
520 <fo:inline color="purple"><xsl:apply-templates mode="xslthl"/></fo:inline>
521 </xsl:template>
522
523 <xsl:template match='xslthl:value' mode="xslthl">
524 <fo:inline color="blue"><xsl:apply-templates mode="xslthl"/></fo:inline>
525 </xsl:template>
526 </xsl:stylesheet>