source: stylesheets/lfs-xsl/pdf/lfs-mixed.xsl@ 52dcb7d

11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 52dcb7d was 52dcb7d, checked in by Xℹ Ruoyao <xry111@…>, 3 years ago

remove $Date$ and $LastChangedBy$

They are unsupported by Git.

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