1 | <?xml version='1.0' encoding='UTF-8'?>
|
---|
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 formatting.
|
---|
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 | <xsl:otherwise>always</xsl:otherwise>
|
---|
98 | </xsl:choose>
|
---|
99 | </xsl:attribute>
|
---|
100 | <xsl:apply-imports/>
|
---|
101 | </fo:block>
|
---|
102 | </xsl:template>
|
---|
103 |
|
---|
104 | <!-- literal:
|
---|
105 | Be sure that literal will use always normal font weight. -->
|
---|
106 | <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
|
---|
107 | <xsl:template match="literal">
|
---|
108 | <fo:inline font-weight="normal">
|
---|
109 | <xsl:call-template name="inline.monoseq"/>
|
---|
110 | </fo:inline>
|
---|
111 | </xsl:template>
|
---|
112 |
|
---|
113 | <!-- inline.monoseq:
|
---|
114 | Added hyphenate-url support to classname, exceptionname, interfacename,
|
---|
115 | methodname, computeroutput, constant, envar, filename, function, code,
|
---|
116 | literal, option, prompt, systemitem, varname, sgmltag, tag, and uri -->
|
---|
117 | <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
|
---|
118 | <xsl:template name="inline.monoseq">
|
---|
119 | <xsl:param name="content">
|
---|
120 | <xsl:call-template name="simple.xlink">
|
---|
121 | <xsl:with-param name="content">
|
---|
122 | <xsl:choose>
|
---|
123 | <xsl:when test="ancestor::para and not(ancestor::screen)
|
---|
124 | and not(descendant::ulink)">
|
---|
125 | <xsl:call-template name="hyphenate-url">
|
---|
126 | <xsl:with-param name="url">
|
---|
127 | <xsl:apply-templates/>
|
---|
128 | </xsl:with-param>
|
---|
129 | </xsl:call-template>
|
---|
130 | </xsl:when>
|
---|
131 | <xsl:otherwise>
|
---|
132 | <xsl:apply-templates/>
|
---|
133 | </xsl:otherwise>
|
---|
134 | </xsl:choose>
|
---|
135 | </xsl:with-param>
|
---|
136 | </xsl:call-template>
|
---|
137 | </xsl:param>
|
---|
138 | <fo:inline xsl:use-attribute-sets="monospace.properties">
|
---|
139 | <xsl:if test="@dir">
|
---|
140 | <xsl:attribute name="direction">
|
---|
141 | <xsl:choose>
|
---|
142 | <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
|
---|
143 | <xsl:otherwise>rtl</xsl:otherwise>
|
---|
144 | </xsl:choose>
|
---|
145 | </xsl:attribute>
|
---|
146 | </xsl:if>
|
---|
147 | <xsl:copy-of select="$content"/>
|
---|
148 | </fo:inline>
|
---|
149 | </xsl:template>
|
---|
150 |
|
---|
151 | <!-- inline.italicmonoseq:
|
---|
152 | Added hyphenate-url support to parameter, replaceable, structfield,
|
---|
153 | function/parameter, and function/replaceable -->
|
---|
154 | <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
|
---|
155 | <xsl:template name="inline.italicmonoseq">
|
---|
156 | <xsl:param name="content">
|
---|
157 | <xsl:call-template name="simple.xlink">
|
---|
158 | <xsl:with-param name="content">
|
---|
159 | <xsl:choose>
|
---|
160 | <xsl:when test="ancestor::para and not(ancestor::screen)
|
---|
161 | and not(descendant::ulink)">
|
---|
162 | <xsl:call-template name="hyphenate-url">
|
---|
163 | <xsl:with-param name="url">
|
---|
164 | <xsl:apply-templates/>
|
---|
165 | </xsl:with-param>
|
---|
166 | </xsl:call-template>
|
---|
167 | </xsl:when>
|
---|
168 | <xsl:otherwise>
|
---|
169 | <xsl:apply-templates/>
|
---|
170 | </xsl:otherwise>
|
---|
171 | </xsl:choose>
|
---|
172 | </xsl:with-param>
|
---|
173 | </xsl:call-template>
|
---|
174 | </xsl:param>
|
---|
175 | <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
|
---|
176 | <xsl:call-template name="anchor"/>
|
---|
177 | <xsl:if test="@dir">
|
---|
178 | <xsl:attribute name="direction">
|
---|
179 | <xsl:choose>
|
---|
180 | <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
|
---|
181 | <xsl:otherwise>rtl</xsl:otherwise>
|
---|
182 | </xsl:choose>
|
---|
183 | </xsl:attribute>
|
---|
184 | </xsl:if>
|
---|
185 | <xsl:copy-of select="$content"/>
|
---|
186 | </fo:inline>
|
---|
187 | </xsl:template>
|
---|
188 |
|
---|
189 | <!-- Show external URLs in italic font -->
|
---|
190 | <xsl:attribute-set name="xref.properties">
|
---|
191 | <xsl:attribute name="font-style">
|
---|
192 | <xsl:choose>
|
---|
193 | <xsl:when test="self::ulink">italic</xsl:when>
|
---|
194 | <xsl:otherwise>inherit</xsl:otherwise>
|
---|
195 | </xsl:choose>
|
---|
196 | </xsl:attribute>
|
---|
197 | </xsl:attribute-set>
|
---|
198 |
|
---|
199 | <!-- Center table title. -->
|
---|
200 | <xsl:attribute-set name="formal.title.properties">
|
---|
201 | <xsl:attribute name="text-align">
|
---|
202 | <xsl:choose>
|
---|
203 | <xsl:when test="local-name(.) = 'table'">center</xsl:when>
|
---|
204 | <xsl:otherwise>left</xsl:otherwise>
|
---|
205 | </xsl:choose>
|
---|
206 | </xsl:attribute>
|
---|
207 | </xsl:attribute-set>
|
---|
208 |
|
---|
209 | <!-- table.layout:
|
---|
210 | We want all tables centered. Based on a hack posted
|
---|
211 | by Ellen Juhlin on docbook-apps mailing list. -->
|
---|
212 | <!-- The original template is in {docbook-xsl}/fo/table.xsl -->
|
---|
213 | <xsl:template name="table.layout">
|
---|
214 | <xsl:param name="table.content" select="NOTANODE"/>
|
---|
215 | <fo:table table-layout="fixed" width="100%">
|
---|
216 | <fo:table-column column-width ="proportional-column-width(1)"/>
|
---|
217 | <fo:table-column>
|
---|
218 | <!-- Set center column width equal to table width -->
|
---|
219 | <xsl:attribute name="column-width">
|
---|
220 | <xsl:call-template name="table.width"/>
|
---|
221 | </xsl:attribute>
|
---|
222 | </fo:table-column>
|
---|
223 | <fo:table-column column-width ="proportional-column-width(1)"/>
|
---|
224 | <fo:table-body>
|
---|
225 | <fo:table-row>
|
---|
226 | <fo:table-cell column-number="2">
|
---|
227 | <xsl:copy-of select="$table.content"/>
|
---|
228 | </fo:table-cell>
|
---|
229 | </fo:table-row>
|
---|
230 | </fo:table-body>
|
---|
231 | </fo:table>
|
---|
232 | </xsl:template>
|
---|
233 |
|
---|
234 |
|
---|
235 | <!-- Revision History -->
|
---|
236 |
|
---|
237 | <!-- revhistory titlepage:
|
---|
238 | Self-made template to add missing support on bookinfo. -->
|
---|
239 | <xsl:template match="revhistory" mode="book.titlepage.verso.auto.mode">
|
---|
240 | <fo:block space-before.optimum="2em"
|
---|
241 | space-before.minimum="1.5em"
|
---|
242 | space-before.maximum="2.5em">
|
---|
243 | <xsl:apply-templates select="." mode="book.titlepage.verso.mode"/>
|
---|
244 | </fo:block>
|
---|
245 | </xsl:template>
|
---|
246 |
|
---|
247 | <!-- revhitory title properties -->
|
---|
248 | <xsl:attribute-set name="revhistory.title.properties">
|
---|
249 | <xsl:attribute name="text-align">center</xsl:attribute>
|
---|
250 | <xsl:attribute name="font-weight">bold</xsl:attribute>
|
---|
251 | </xsl:attribute-set>
|
---|
252 |
|
---|
253 | <!-- revhistory/revision mode titlepage.mode:
|
---|
254 | Removed authorinitials | author support placing
|
---|
255 | revremark | revdescription instead on that table-cell. -->
|
---|
256 | <!-- The original template is in {docbook-xsl}/fo/titlepage.xsl -->
|
---|
257 | <xsl:template match="revhistory/revision" mode="titlepage.mode">
|
---|
258 | <xsl:variable name="revnumber" select="revnumber"/>
|
---|
259 | <xsl:variable name="revdate" select="date"/>
|
---|
260 | <xsl:variable name="revremark" select="revremark|revdescription"/>
|
---|
261 | <fo:table-row>
|
---|
262 | <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
|
---|
263 | <fo:block>
|
---|
264 | <xsl:if test="$revnumber">
|
---|
265 | <xsl:call-template name="gentext">
|
---|
266 | <xsl:with-param name="key" select="'Revision'"/>
|
---|
267 | </xsl:call-template>
|
---|
268 | <xsl:call-template name="gentext.space"/>
|
---|
269 | <xsl:apply-templates select="$revnumber[1]" mode="titlepage.mode"/>
|
---|
270 | </xsl:if>
|
---|
271 | </fo:block>
|
---|
272 | </fo:table-cell>
|
---|
273 | <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
|
---|
274 | <fo:block>
|
---|
275 | <xsl:apply-templates select="$revdate[1]"/>
|
---|
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="$revremark[1]"/>
|
---|
281 | </fo:block>
|
---|
282 | </fo:table-cell>
|
---|
283 | </fo:table-row>
|
---|
284 | </xsl:template>
|
---|
285 |
|
---|
286 |
|
---|
287 | <!-- Dummy sect1 -->
|
---|
288 |
|
---|
289 | <!-- sect1:
|
---|
290 | Self-made template to skip dummy sect1 pages generation. -->
|
---|
291 | <xsl:template match="sect1">
|
---|
292 | <xsl:choose>
|
---|
293 | <xsl:when test="@role = 'dummy'"/>
|
---|
294 | <xsl:otherwise>
|
---|
295 | <xsl:apply-imports/>
|
---|
296 | </xsl:otherwise>
|
---|
297 | </xsl:choose>
|
---|
298 | </xsl:template>
|
---|
299 |
|
---|
300 | <!-- sect1 mode fop1.outline:
|
---|
301 | Self-made template to skip dummy sect1 bookmarks generation. -->
|
---|
302 | <xsl:template match="sect1" mode="fop1.outline">
|
---|
303 | <xsl:choose>
|
---|
304 | <xsl:when test="@role = 'dummy'"/>
|
---|
305 | <xsl:otherwise>
|
---|
306 | <xsl:apply-imports/>
|
---|
307 | </xsl:otherwise>
|
---|
308 | </xsl:choose>
|
---|
309 | </xsl:template>
|
---|
310 |
|
---|
311 | <!-- toc.line:
|
---|
312 | For dummy sect1 output only the title. -->
|
---|
313 | <!-- The original template is in {docbook-xsl}/fo/autotoc.xsl -->
|
---|
314 | <xsl:template name="toc.line">
|
---|
315 | <xsl:param name="toc-context" select="NOTANODE"/>
|
---|
316 | <xsl:variable name="id">
|
---|
317 | <xsl:call-template name="object.id"/>
|
---|
318 | </xsl:variable>
|
---|
319 | <xsl:variable name="label">
|
---|
320 | <xsl:apply-templates select="." mode="label.markup"/>
|
---|
321 | </xsl:variable>
|
---|
322 | <xsl:choose>
|
---|
323 | <xsl:when test="@role = 'dummy'">
|
---|
324 | <fo:block text-align="left">
|
---|
325 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
326 | </fo:block>
|
---|
327 | </xsl:when>
|
---|
328 | <xsl:otherwise>
|
---|
329 | <fo:block xsl:use-attribute-sets="toc.line.properties">
|
---|
330 | <fo:inline keep-with-next.within-line="always">
|
---|
331 | <fo:basic-link internal-destination="{$id}">
|
---|
332 | <xsl:if test="$label != ''">
|
---|
333 | <xsl:copy-of select="$label"/>
|
---|
334 | <xsl:value-of select="$autotoc.label.separator"/>
|
---|
335 | </xsl:if>
|
---|
336 | <xsl:apply-templates select="." mode="titleabbrev.markup"/>
|
---|
337 | </fo:basic-link>
|
---|
338 | </fo:inline>
|
---|
339 | <fo:inline keep-together.within-line="always">
|
---|
340 | <xsl:text> </xsl:text>
|
---|
341 | <fo:leader leader-pattern="dots"
|
---|
342 | leader-pattern-width="3pt"
|
---|
343 | leader-alignment="reference-area"
|
---|
344 | keep-with-next.within-line="always"/>
|
---|
345 | <xsl:text> </xsl:text>
|
---|
346 | <fo:basic-link internal-destination="{$id}">
|
---|
347 | <fo:page-number-citation ref-id="{$id}"/>
|
---|
348 | </fo:basic-link>
|
---|
349 | </fo:inline>
|
---|
350 | </fo:block>
|
---|
351 | </xsl:otherwise>
|
---|
352 | </xsl:choose>
|
---|
353 | </xsl:template>
|
---|
354 |
|
---|
355 | </xsl:stylesheet>
|
---|