source: BOOK/stylesheets/lfs-xsl/pdf/lfs-mixed.xsl@ ff8774f

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since ff8774f was f8c4e94, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 13.6 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?>
2
3<!--
4$LastChangedBy$
5$Date$
6-->
7
8<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
9 xmlns:fo="http://www.w3.org/1999/XSL/Format"
10 version="1.0">
11
12 <!-- This stylesheet contains misc params, attribute sets and templates
13 for output formating.
14 This file is for that templates that don't fit in other files. -->
15
16 <!-- What space do you want between normal paragraphs. -->
17 <xsl:attribute-set name="normal.para.spacing">
18 <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
19 <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
20 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
21 <xsl:attribute name="orphans">3</xsl:attribute>
22 <xsl:attribute name="widows">3</xsl:attribute>
23 </xsl:attribute-set>
24
25 <!-- Properties associated with verbatim text. -->
26 <xsl:attribute-set name="verbatim.properties">
27 <xsl:attribute name="keep-with-previous.within-column">always</xsl:attribute>
28 <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
29 <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
30 <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
31 <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
32 <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
33 <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
34 <xsl:attribute name="hyphenate">false</xsl:attribute>
35 <xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
36 <xsl:attribute name="white-space-collapse">false</xsl:attribute>
37 <xsl:attribute name="white-space-treatment">preserve</xsl:attribute>
38 <xsl:attribute name="linefeed-treatment">preserve</xsl:attribute>
39 <xsl:attribute name="text-align">start</xsl:attribute>
40 </xsl:attribute-set>
41
42 <!-- Should verbatim environments be shaded? 1 =yes, 0 = no -->
43 <xsl:param name="shade.verbatim" select="1"/>
44
45 <!-- Properties that specify the style of shaded verbatim listings -->
46 <xsl:attribute-set name="shade.verbatim.style">
47 <xsl:attribute name="background-color">#E9E9E9</xsl:attribute>
48 <xsl:attribute name="border-style">solid</xsl:attribute>
49 <xsl:attribute name="border-width">0.5pt</xsl:attribute>
50 <xsl:attribute name="border-color">#888</xsl:attribute>
51 <xsl:attribute name="padding-start">5pt</xsl:attribute>
52 <xsl:attribute name="padding-top">2pt</xsl:attribute>
53 <xsl:attribute name="padding-bottom">2pt</xsl:attribute>
54 </xsl:attribute-set>
55
56 <!-- para:
57 Skip empty "Home page" in packages.xml.
58 Allow forced line breaks inside paragraphs emulating literallayout.
59 Removed vertical space in variablelist. -->
60 <!-- The original template is in {docbook-xsl}/fo/block.xsl -->
61 <xsl:template match="para">
62 <xsl:choose>
63 <xsl:when test="child::ulink[@url=' ']"/>
64 <xsl:when test="./@remap='verbatim'">
65 <fo:block xsl:use-attribute-sets="verbatim.properties">
66 <xsl:call-template name="anchor"/>
67 <xsl:apply-templates/>
68 </fo:block>
69 </xsl:when>
70 <xsl:when test="ancestor::variablelist">
71 <fo:block>
72 <xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
73 <xsl:attribute name="space-before.minimum">0em</xsl:attribute>
74 <xsl:attribute name="space-before.maximum">0.2em</xsl:attribute>
75 <xsl:call-template name="anchor"/>
76 <xsl:apply-templates/>
77 </fo:block>
78 </xsl:when>
79 <xsl:otherwise>
80 <fo:block xsl:use-attribute-sets="normal.para.spacing">
81 <xsl:call-template name="anchor"/>
82 <xsl:apply-templates/>
83 </fo:block>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <!-- screen, literallayout:
89 Self-made template that creates a fo:block wrapper with keep-together
90 processing instruction support around the output generated by
91 original screen templates. -->
92 <xsl:template match="screen|literallayout">
93 <xsl:variable name="keep.together">
94 <xsl:call-template name="pi.dbfo_keep-together"/>
95 </xsl:variable>
96 <fo:block>
97 <xsl:attribute name="keep-together.within-column">
98 <xsl:choose>
99 <xsl:when test="$keep.together != ''">
100 <xsl:value-of select="$keep.together"/>
101 </xsl:when>
102 <xsl:otherwise>always</xsl:otherwise>
103 </xsl:choose>
104 </xsl:attribute>
105 <xsl:apply-imports/>
106 </fo:block>
107 </xsl:template>
108
109 <!-- literal:
110 Be sure that literal will use allways normal font weight. -->
111 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
112 <xsl:template match="literal">
113 <fo:inline font-weight="normal">
114 <xsl:call-template name="inline.monoseq"/>
115 </fo:inline>
116 </xsl:template>
117
118 <!-- inline.monoseq:
119 Added hyphenate-url support to classname, exceptionname, interfacename,
120 methodname, computeroutput, constant, envar, filename, function, code,
121 literal, option, promt, systemitem, varname, sgmltag, tag, and uri -->
122 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
123 <xsl:template name="inline.monoseq">
124 <xsl:param name="content">
125 <xsl:call-template name="simple.xlink">
126 <xsl:with-param name="content">
127 <xsl:choose>
128 <xsl:when test="ancestor::para and not(ancestor::screen)
129 and not(descendant::ulink)">
130 <xsl:call-template name="hyphenate-url">
131 <xsl:with-param name="url">
132 <xsl:apply-templates/>
133 </xsl:with-param>
134 </xsl:call-template>
135 </xsl:when>
136 <xsl:otherwise>
137 <xsl:apply-templates/>
138 </xsl:otherwise>
139 </xsl:choose>
140 </xsl:with-param>
141 </xsl:call-template>
142 </xsl:param>
143 <fo:inline xsl:use-attribute-sets="monospace.properties">
144 <xsl:if test="@dir">
145 <xsl:attribute name="direction">
146 <xsl:choose>
147 <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
148 <xsl:otherwise>rtl</xsl:otherwise>
149 </xsl:choose>
150 </xsl:attribute>
151 </xsl:if>
152 <xsl:copy-of select="$content"/>
153 </fo:inline>
154 </xsl:template>
155
156 <!-- inline.italicmonoseq:
157 Added hyphenate-url support to parameter, replaceable, structfield,
158 function/parameter, and function/replaceable -->
159 <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
160 <xsl:template name="inline.italicmonoseq">
161 <xsl:param name="content">
162 <xsl:call-template name="simple.xlink">
163 <xsl:with-param name="content">
164 <xsl:choose>
165 <xsl:when test="ancestor::para and not(ancestor::screen)
166 and not(descendant::ulink)">
167 <xsl:call-template name="hyphenate-url">
168 <xsl:with-param name="url">
169 <xsl:apply-templates/>
170 </xsl:with-param>
171 </xsl:call-template>
172 </xsl:when>
173 <xsl:otherwise>
174 <xsl:apply-templates/>
175 </xsl:otherwise>
176 </xsl:choose>
177 </xsl:with-param>
178 </xsl:call-template>
179 </xsl:param>
180 <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
181 <xsl:call-template name="anchor"/>
182 <xsl:if test="@dir">
183 <xsl:attribute name="direction">
184 <xsl:choose>
185 <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
186 <xsl:otherwise>rtl</xsl:otherwise>
187 </xsl:choose>
188 </xsl:attribute>
189 </xsl:if>
190 <xsl:copy-of select="$content"/>
191 </fo:inline>
192 </xsl:template>
193
194 <!-- Show external URLs in italic font -->
195 <xsl:attribute-set name="xref.properties">
196 <xsl:attribute name="font-style">
197 <xsl:choose>
198 <xsl:when test="self::ulink">italic</xsl:when>
199 <xsl:otherwise>inherit</xsl:otherwise>
200 </xsl:choose>
201 </xsl:attribute>
202 </xsl:attribute-set>
203
204 <!-- Center table title. -->
205 <xsl:attribute-set name="formal.title.properties">
206 <xsl:attribute name="text-align">
207 <xsl:choose>
208 <xsl:when test="local-name(.) = 'table'">center</xsl:when>
209 <xsl:otherwise>left</xsl:otherwise>
210 </xsl:choose>
211 </xsl:attribute>
212 </xsl:attribute-set>
213
214 <!-- table.layout:
215 We want all tables centered. Based on a hack posted
216 by Ellen Juhlin on docbook-apps mailing list. -->
217 <!-- The original template is in {docbook-xsl}/fo/table.xsl -->
218 <xsl:template name="table.layout">
219 <xsl:param name="table.content" select="NOTANODE"/>
220 <fo:table table-layout="fixed" width="100%">
221 <fo:table-column column-width ="proportional-column-width(1)"/>
222 <fo:table-column>
223 <!-- Set center column width equal to table width -->
224 <xsl:attribute name="column-width">
225 <xsl:call-template name="table.width"/>
226 </xsl:attribute>
227 </fo:table-column>
228 <fo:table-column column-width ="proportional-column-width(1)"/>
229 <fo:table-body>
230 <fo:table-row>
231 <fo:table-cell column-number="2">
232 <xsl:copy-of select="$table.content"/>
233 </fo:table-cell>
234 </fo:table-row>
235 </fo:table-body>
236 </fo:table>
237 </xsl:template>
238
239
240 <!-- Revision History -->
241
242 <!-- revhistory titlepage:
243 Self-made template to add missing support on bookinfo. -->
244 <xsl:template match="revhistory" mode="book.titlepage.verso.auto.mode">
245 <fo:block space-before.optimum="2em"
246 space-before.minimum="1.5em"
247 space-before.maximum="2.5em">
248 <xsl:apply-templates select="." mode="book.titlepage.verso.mode"/>
249 </fo:block>
250 </xsl:template>
251
252 <!-- revhitory title properties -->
253 <xsl:attribute-set name="revhistory.title.properties">
254 <xsl:attribute name="text-align">center</xsl:attribute>
255 <xsl:attribute name="font-weight">bold</xsl:attribute>
256 </xsl:attribute-set>
257
258 <!-- revhistory/revision mode titlepage.mode:
259 Removed authorinitials | author support placing
260 revremark | revdescription instead on that table-cell. -->
261 <!-- The original template is in {docbook-xsl}/fo/titlepage.xsl -->
262 <xsl:template match="revhistory/revision" mode="titlepage.mode">
263 <xsl:variable name="revnumber" select="revnumber"/>
264 <xsl:variable name="revdate" select="date"/>
265 <xsl:variable name="revremark" select="revremark|revdescription"/>
266 <fo:table-row>
267 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
268 <fo:block>
269 <xsl:if test="$revnumber">
270 <xsl:call-template name="gentext">
271 <xsl:with-param name="key" select="'Revision'"/>
272 </xsl:call-template>
273 <xsl:call-template name="gentext.space"/>
274 <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
275 </xsl:if>
276 </fo:block>
277 </fo:table-cell>
278 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
279 <fo:block>
280 <xsl:apply-templates select="$revdate[1]"/>
281 </fo:block>
282 </fo:table-cell>
283 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
284 <fo:block>
285 <xsl:apply-templates select="$revremark[1]"/>
286 </fo:block>
287 </fo:table-cell>
288 </fo:table-row>
289 </xsl:template>
290
291
292 <!-- Dummy sect1 -->
293
294 <!-- sect1:
295 Self-made template to skip dummy sect1 pages generation. -->
296 <xsl:template match="sect1">
297 <xsl:choose>
298 <xsl:when test="@role = 'dummy'"/>
299 <xsl:otherwise>
300 <xsl:apply-imports/>
301 </xsl:otherwise>
302 </xsl:choose>
303 </xsl:template>
304
305 <!-- sect1 mode fop1.outline:
306 Self-made template to skip dummy sect1 bookmarks generation. -->
307 <xsl:template match="sect1" mode="fop1.outline">
308 <xsl:choose>
309 <xsl:when test="@role = 'dummy'"/>
310 <xsl:otherwise>
311 <xsl:apply-imports/>
312 </xsl:otherwise>
313 </xsl:choose>
314 </xsl:template>
315
316 <!-- toc.line:
317 For dummy sect1 output only the title. -->
318 <!-- The original template is in {docbook-xsl}/fo/autotoc.xsl -->
319 <xsl:template name="toc.line">
320 <xsl:param name="toc-context" select="NOTANODE"/>
321 <xsl:variable name="id">
322 <xsl:call-template name="object.id"/>
323 </xsl:variable>
324 <xsl:variable name="label">
325 <xsl:apply-templates select="." mode="label.markup"/>
326 </xsl:variable>
327 <xsl:choose>
328 <xsl:when test="@role = 'dummy'">
329 <fo:block text-align="left">
330 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
331 </fo:block>
332 </xsl:when>
333 <xsl:otherwise>
334 <fo:block xsl:use-attribute-sets="toc.line.properties">
335 <fo:inline keep-with-next.within-line="always">
336 <fo:basic-link internal-destination="{$id}">
337 <xsl:if test="$label != ''">
338 <xsl:copy-of select="$label"/>
339 <xsl:value-of select="$autotoc.label.separator"/>
340 </xsl:if>
341 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
342 </fo:basic-link>
343 </fo:inline>
344 <fo:inline keep-together.within-line="always">
345 <xsl:text> </xsl:text>
346 <fo:leader leader-pattern="dots"
347 leader-pattern-width="3pt"
348 leader-alignment="reference-area"
349 keep-with-next.within-line="always"/>
350 <xsl:text> </xsl:text>
351 <fo:basic-link internal-destination="{$id}">
352 <fo:page-number-citation ref-id="{$id}"/>
353 </fo:basic-link>
354 </fo:inline>
355 </fo:block>
356 </xsl:otherwise>
357 </xsl:choose>
358 </xsl:template>
359
360</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.