source: BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/division.xsl@ 2d560a1

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

Added LFS XSL Stylesheets.

  • Property mode set to 100644
File size: 22.6 KB
Line 
1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
5 version='1.0'>
6
7<!-- ********************************************************************
8 $Id$
9 ********************************************************************
10
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://docbook.sf.net/release/xsl/current/ for
13 copyright and other information.
14
15 ******************************************************************** -->
16
17<!-- ==================================================================== -->
18
19<xsl:template name="division.title">
20 <xsl:param name="node" select="."/>
21 <xsl:variable name="id">
22 <xsl:call-template name="object.id">
23 <xsl:with-param name="object" select="$node"/>
24 </xsl:call-template>
25 </xsl:variable>
26 <xsl:variable name="title">
27 <xsl:apply-templates select="$node" mode="object.title.markup"/>
28 </xsl:variable>
29
30 <xsl:if test="$passivetex.extensions != 0">
31 <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
32 fotex-bookmark-level="1"
33 fotex-bookmark-label="{$id}">
34 <xsl:value-of select="$title"/>
35 </fotex:bookmark>
36 </xsl:if>
37
38 <fo:block keep-with-next.within-column="always"
39 hyphenate="false">
40 <xsl:if test="$axf.extensions != 0">
41 <xsl:attribute name="axf:outline-level">
42 <xsl:choose>
43 <xsl:when test="count($node/ancestor::*) > 0">
44 <xsl:value-of select="count($node/ancestor::*)"/>
45 </xsl:when>
46 <xsl:otherwise>1</xsl:otherwise>
47 </xsl:choose>
48 </xsl:attribute>
49 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
50 <xsl:attribute name="axf:outline-title">
51 <xsl:value-of select="normalize-space($title)"/>
52 </xsl:attribute>
53 </xsl:if>
54 <xsl:copy-of select="$title"/>
55 </fo:block>
56</xsl:template>
57
58<!-- ==================================================================== -->
59
60<xsl:template match="set">
61 <xsl:variable name="id">
62 <xsl:call-template name="object.id"/>
63 </xsl:variable>
64
65 <xsl:variable name="preamble"
66 select="*[not(self::book or self::setindex)]"/>
67
68 <xsl:variable name="content" select="book|setindex"/>
69
70 <xsl:variable name="titlepage-master-reference">
71 <xsl:call-template name="select.pagemaster">
72 <xsl:with-param name="pageclass" select="'titlepage'"/>
73 </xsl:call-template>
74 </xsl:variable>
75
76 <xsl:variable name="lot-master-reference">
77 <xsl:call-template name="select.pagemaster">
78 <xsl:with-param name="pageclass" select="'lot'"/>
79 </xsl:call-template>
80 </xsl:variable>
81
82 <xsl:if test="$preamble">
83 <fo:page-sequence hyphenate="{$hyphenate}"
84 master-reference="{$titlepage-master-reference}">
85 <xsl:attribute name="language">
86 <xsl:call-template name="l10n.language"/>
87 </xsl:attribute>
88 <xsl:attribute name="format">
89 <xsl:call-template name="page.number.format">
90 <xsl:with-param name="master-reference"
91 select="$titlepage-master-reference"/>
92 </xsl:call-template>
93 </xsl:attribute>
94
95 <xsl:attribute name="initial-page-number">
96 <xsl:call-template name="initial.page.number">
97 <xsl:with-param name="master-reference"
98 select="$titlepage-master-reference"/>
99 </xsl:call-template>
100 </xsl:attribute>
101
102 <xsl:attribute name="force-page-count">
103 <xsl:call-template name="force.page.count">
104 <xsl:with-param name="master-reference"
105 select="$titlepage-master-reference"/>
106 </xsl:call-template>
107 </xsl:attribute>
108
109 <xsl:attribute name="hyphenation-character">
110 <xsl:call-template name="gentext">
111 <xsl:with-param name="key" select="'hyphenation-character'"/>
112 </xsl:call-template>
113 </xsl:attribute>
114 <xsl:attribute name="hyphenation-push-character-count">
115 <xsl:call-template name="gentext">
116 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
117 </xsl:call-template>
118 </xsl:attribute>
119 <xsl:attribute name="hyphenation-remain-character-count">
120 <xsl:call-template name="gentext">
121 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
122 </xsl:call-template>
123 </xsl:attribute>
124
125 <xsl:apply-templates select="." mode="running.head.mode">
126 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
127 </xsl:apply-templates>
128
129 <xsl:apply-templates select="." mode="running.foot.mode">
130 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
131 </xsl:apply-templates>
132
133 <fo:flow flow-name="xsl-region-body">
134 <xsl:call-template name="set.flow.properties">
135 <xsl:with-param name="element" select="local-name(.)"/>
136 <xsl:with-param name="master-reference"
137 select="$titlepage-master-reference"/>
138 </xsl:call-template>
139
140 <fo:block id="{$id}">
141 <xsl:call-template name="set.titlepage"/>
142 </fo:block>
143 </fo:flow>
144 </fo:page-sequence>
145 </xsl:if>
146
147 <xsl:variable name="toc.params">
148 <xsl:call-template name="find.path.params">
149 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
150 </xsl:call-template>
151 </xsl:variable>
152
153 <xsl:if test="contains($toc.params, 'toc')">
154 <fo:page-sequence hyphenate="{$hyphenate}"
155 master-reference="{$lot-master-reference}">
156 <xsl:attribute name="language">
157 <xsl:call-template name="l10n.language"/>
158 </xsl:attribute>
159 <xsl:attribute name="format">
160 <xsl:call-template name="page.number.format">
161 <xsl:with-param name="element" select="'toc'"/>
162 <xsl:with-param name="master-reference"
163 select="$lot-master-reference"/>
164 </xsl:call-template>
165 </xsl:attribute>
166 <xsl:attribute name="initial-page-number">
167 <xsl:call-template name="initial.page.number">
168 <xsl:with-param name="master-reference"
169 select="$lot-master-reference"/>
170 </xsl:call-template>
171 </xsl:attribute>
172 <xsl:attribute name="force-page-count">
173 <xsl:call-template name="force.page.count">
174 <xsl:with-param name="master-reference"
175 select="$lot-master-reference"/>
176 </xsl:call-template>
177 </xsl:attribute>
178
179 <xsl:attribute name="hyphenation-character">
180 <xsl:call-template name="gentext">
181 <xsl:with-param name="key" select="'hyphenation-character'"/>
182 </xsl:call-template>
183 </xsl:attribute>
184 <xsl:attribute name="hyphenation-push-character-count">
185 <xsl:call-template name="gentext">
186 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
187 </xsl:call-template>
188 </xsl:attribute>
189 <xsl:attribute name="hyphenation-remain-character-count">
190 <xsl:call-template name="gentext">
191 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
192 </xsl:call-template>
193 </xsl:attribute>
194
195 <xsl:apply-templates select="." mode="running.head.mode">
196 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
197 </xsl:apply-templates>
198
199 <xsl:apply-templates select="." mode="running.foot.mode">
200 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
201 </xsl:apply-templates>
202
203 <fo:flow flow-name="xsl-region-body">
204 <xsl:call-template name="set.flow.properties">
205 <xsl:with-param name="element" select="local-name(.)"/>
206 <xsl:with-param name="master-reference"
207 select="$lot-master-reference"/>
208 </xsl:call-template>
209
210 <xsl:call-template name="set.toc"/>
211 </fo:flow>
212 </fo:page-sequence>
213 </xsl:if>
214
215 <xsl:apply-templates select="$content"/>
216</xsl:template>
217
218<xsl:template match="set/setinfo"></xsl:template>
219<xsl:template match="set/title"></xsl:template>
220<xsl:template match="set/subtitle"></xsl:template>
221<xsl:template match="set/titleabbrev"></xsl:template>
222
223<!-- ==================================================================== -->
224
225<xsl:template match="book">
226 <xsl:variable name="id">
227 <xsl:call-template name="object.id"/>
228 </xsl:variable>
229
230 <xsl:variable name="preamble"
231 select="title|subtitle|titleabbrev|bookinfo|info"/>
232
233 <xsl:variable name="content"
234 select="node()[not(self::title or self::subtitle
235 or self::titleabbrev
236 or self::info
237 or self::bookinfo)]"/>
238
239 <xsl:variable name="titlepage-master-reference">
240 <xsl:call-template name="select.pagemaster">
241 <xsl:with-param name="pageclass" select="'titlepage'"/>
242 </xsl:call-template>
243 </xsl:variable>
244
245 <xsl:call-template name="front.cover"/>
246
247 <xsl:if test="$preamble">
248 <xsl:call-template name="page.sequence">
249 <xsl:with-param name="master-reference"
250 select="$titlepage-master-reference"/>
251 <xsl:with-param name="content">
252 <fo:block id="{$id}">
253 <xsl:call-template name="book.titlepage"/>
254 </fo:block>
255 </xsl:with-param>
256 </xsl:call-template>
257 </xsl:if>
258
259 <xsl:apply-templates select="dedication" mode="dedication"/>
260
261 <xsl:call-template name="make.book.tocs"/>
262
263 <xsl:apply-templates select="$content"/>
264
265 <xsl:call-template name="back.cover"/>
266
267</xsl:template>
268
269<xsl:template match="book/bookinfo"></xsl:template>
270<xsl:template match="book/info"></xsl:template>
271<xsl:template match="book/title"></xsl:template>
272<xsl:template match="book/subtitle"></xsl:template>
273<xsl:template match="book/titleabbrev"></xsl:template>
274
275<!-- Placeholder templates -->
276<xsl:template name="front.cover"/>
277<xsl:template name="back.cover"/>
278
279<!-- ================================================================= -->
280<xsl:template name="make.book.tocs">
281
282 <xsl:variable name="lot-master-reference">
283 <xsl:call-template name="select.pagemaster">
284 <xsl:with-param name="pageclass" select="'lot'"/>
285 </xsl:call-template>
286 </xsl:variable>
287
288 <xsl:variable name="toc.params">
289 <xsl:call-template name="find.path.params">
290 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
291 </xsl:call-template>
292 </xsl:variable>
293
294 <xsl:if test="contains($toc.params, 'toc')">
295 <xsl:call-template name="page.sequence">
296 <xsl:with-param name="master-reference"
297 select="$lot-master-reference"/>
298 <xsl:with-param name="element" select="'toc'"/>
299 <xsl:with-param name="gentext-key" select="'TableofContents'"/>
300 <xsl:with-param name="content">
301 <xsl:call-template name="division.toc">
302 <xsl:with-param name="toc.title.p"
303 select="contains($toc.params, 'title')"/>
304 </xsl:call-template>
305 </xsl:with-param>
306 </xsl:call-template>
307 </xsl:if>
308
309 <xsl:if test="contains($toc.params,'figure') and .//figure">
310 <xsl:call-template name="page.sequence">
311 <xsl:with-param name="master-reference"
312 select="$lot-master-reference"/>
313 <xsl:with-param name="element" select="'toc'"/>
314 <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
315 <xsl:with-param name="content">
316 <xsl:call-template name="list.of.titles">
317 <xsl:with-param name="titles" select="'figure'"/>
318 <xsl:with-param name="nodes" select=".//figure"/>
319 </xsl:call-template>
320 </xsl:with-param>
321 </xsl:call-template>
322 </xsl:if>
323
324 <xsl:if test="contains($toc.params,'table') and .//table">
325 <xsl:call-template name="page.sequence">
326 <xsl:with-param name="master-reference"
327 select="$lot-master-reference"/>
328 <xsl:with-param name="element" select="'toc'"/>
329 <xsl:with-param name="gentext-key" select="'ListofTables'"/>
330 <xsl:with-param name="content">
331 <xsl:call-template name="list.of.titles">
332 <xsl:with-param name="titles" select="'table'"/>
333 <xsl:with-param name="nodes" select=".//table"/>
334 </xsl:call-template>
335 </xsl:with-param>
336 </xsl:call-template>
337 </xsl:if>
338
339 <xsl:if test="contains($toc.params,'example') and .//example">
340 <xsl:call-template name="page.sequence">
341 <xsl:with-param name="master-reference"
342 select="$lot-master-reference"/>
343 <xsl:with-param name="element" select="'toc'"/>
344 <xsl:with-param name="gentext-key" select="'ListofExample'"/>
345 <xsl:with-param name="content">
346 <xsl:call-template name="list.of.titles">
347 <xsl:with-param name="titles" select="'example'"/>
348 <xsl:with-param name="nodes" select=".//example"/>
349 </xsl:call-template>
350 </xsl:with-param>
351 </xsl:call-template>
352 </xsl:if>
353
354 <xsl:if test="contains($toc.params,'equation') and
355 .//equation[title or info/title]">
356 <xsl:call-template name="page.sequence">
357 <xsl:with-param name="master-reference"
358 select="$lot-master-reference"/>
359 <xsl:with-param name="element" select="'toc'"/>
360 <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
361 <xsl:with-param name="content">
362 <xsl:call-template name="list.of.titles">
363 <xsl:with-param name="titles" select="'equation'"/>
364 <xsl:with-param name="nodes"
365 select=".//equation[title or info/title]"/>
366 </xsl:call-template>
367 </xsl:with-param>
368 </xsl:call-template>
369 </xsl:if>
370
371 <xsl:if test="contains($toc.params,'procedure') and
372 .//procedure[title or info/title]">
373 <xsl:call-template name="page.sequence">
374 <xsl:with-param name="master-reference"
375 select="$lot-master-reference"/>
376 <xsl:with-param name="element" select="'toc'"/>
377 <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
378 <xsl:with-param name="content">
379 <xsl:call-template name="list.of.titles">
380 <xsl:with-param name="titles" select="'procedure'"/>
381 <xsl:with-param name="nodes"
382 select=".//procedure[title or info/title]"/>
383 </xsl:call-template>
384 </xsl:with-param>
385 </xsl:call-template>
386 </xsl:if>
387</xsl:template>
388<!-- ==================================================================== -->
389
390<xsl:template match="part">
391 <xsl:if test="not(partintro)">
392 <xsl:apply-templates select="." mode="part.titlepage.mode"/>
393 <xsl:call-template name="generate.part.toc"/>
394 </xsl:if>
395 <xsl:apply-templates/>
396</xsl:template>
397
398<xsl:template match="part" mode="part.titlepage.mode">
399 <!-- done this way to force the context node to be the part -->
400 <xsl:param name="additional.content"/>
401
402 <xsl:variable name="id">
403 <xsl:call-template name="object.id"/>
404 </xsl:variable>
405
406 <xsl:variable name="titlepage-master-reference">
407 <xsl:call-template name="select.pagemaster">
408 <xsl:with-param name="pageclass" select="'titlepage'"/>
409 </xsl:call-template>
410 </xsl:variable>
411
412 <fo:page-sequence hyphenate="{$hyphenate}"
413 master-reference="{$titlepage-master-reference}">
414 <xsl:attribute name="language">
415 <xsl:call-template name="l10n.language"/>
416 </xsl:attribute>
417 <xsl:attribute name="format">
418 <xsl:call-template name="page.number.format">
419 <xsl:with-param name="master-reference"
420 select="$titlepage-master-reference"/>
421 </xsl:call-template>
422 </xsl:attribute>
423
424 <xsl:attribute name="initial-page-number">
425 <xsl:call-template name="initial.page.number">
426 <xsl:with-param name="master-reference"
427 select="$titlepage-master-reference"/>
428 </xsl:call-template>
429 </xsl:attribute>
430
431 <xsl:attribute name="force-page-count">
432 <xsl:call-template name="force.page.count">
433 <xsl:with-param name="master-reference"
434 select="$titlepage-master-reference"/>
435 </xsl:call-template>
436 </xsl:attribute>
437
438 <xsl:attribute name="hyphenation-character">
439 <xsl:call-template name="gentext">
440 <xsl:with-param name="key" select="'hyphenation-character'"/>
441 </xsl:call-template>
442 </xsl:attribute>
443 <xsl:attribute name="hyphenation-push-character-count">
444 <xsl:call-template name="gentext">
445 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
446 </xsl:call-template>
447 </xsl:attribute>
448 <xsl:attribute name="hyphenation-remain-character-count">
449 <xsl:call-template name="gentext">
450 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
451 </xsl:call-template>
452 </xsl:attribute>
453
454 <xsl:apply-templates select="." mode="running.head.mode">
455 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
456 </xsl:apply-templates>
457
458 <xsl:apply-templates select="." mode="running.foot.mode">
459 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
460 </xsl:apply-templates>
461
462 <fo:flow flow-name="xsl-region-body">
463 <xsl:call-template name="set.flow.properties">
464 <xsl:with-param name="element" select="local-name(.)"/>
465 <xsl:with-param name="master-reference"
466 select="$titlepage-master-reference"/>
467 </xsl:call-template>
468
469 <fo:block id="{$id}">
470 <xsl:call-template name="part.titlepage"/>
471 </fo:block>
472 <xsl:copy-of select="$additional.content"/>
473 </fo:flow>
474 </fo:page-sequence>
475</xsl:template>
476
477<xsl:template match="part/docinfo|partinfo"></xsl:template>
478<xsl:template match="part/info"></xsl:template>
479<xsl:template match="part/title"></xsl:template>
480<xsl:template match="part/subtitle"></xsl:template>
481<xsl:template match="part/titleabbrev"></xsl:template>
482
483<!-- ==================================================================== -->
484
485<xsl:template name="generate.part.toc">
486 <xsl:param name="part" select="."/>
487
488 <xsl:variable name="lot-master-reference">
489 <xsl:call-template name="select.pagemaster">
490 <xsl:with-param name="pageclass" select="'lot'"/>
491 </xsl:call-template>
492 </xsl:variable>
493
494 <xsl:variable name="toc.params">
495 <xsl:call-template name="find.path.params">
496 <xsl:with-param name="node" select="$part"/>
497 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
498 </xsl:call-template>
499 </xsl:variable>
500
501 <xsl:variable name="nodes" select="reference|
502 preface|
503 chapter|
504 appendix|
505 article|
506 bibliography|
507 glossary|
508 index"/>
509
510 <xsl:if test="count($nodes) &gt; 0 and contains($toc.params, 'toc')">
511 <fo:page-sequence hyphenate="{$hyphenate}"
512 master-reference="{$lot-master-reference}">
513 <xsl:attribute name="language">
514 <xsl:call-template name="l10n.language"/>
515 </xsl:attribute>
516 <xsl:attribute name="format">
517 <xsl:call-template name="page.number.format">
518 <xsl:with-param name="element" select="'toc'"/>
519 <xsl:with-param name="master-reference"
520 select="$lot-master-reference"/>
521 </xsl:call-template>
522 </xsl:attribute>
523 <xsl:attribute name="initial-page-number">
524 <xsl:call-template name="initial.page.number">
525 <xsl:with-param name="element" select="'toc'"/>
526 <xsl:with-param name="master-reference"
527 select="$lot-master-reference"/>
528 </xsl:call-template>
529 </xsl:attribute>
530 <xsl:attribute name="force-page-count">
531 <xsl:call-template name="force.page.count">
532 <xsl:with-param name="master-reference"
533 select="$lot-master-reference"/>
534 </xsl:call-template>
535 </xsl:attribute>
536
537 <xsl:attribute name="hyphenation-character">
538 <xsl:call-template name="gentext">
539 <xsl:with-param name="key" select="'hyphenation-character'"/>
540 </xsl:call-template>
541 </xsl:attribute>
542 <xsl:attribute name="hyphenation-push-character-count">
543 <xsl:call-template name="gentext">
544 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
545 </xsl:call-template>
546 </xsl:attribute>
547 <xsl:attribute name="hyphenation-remain-character-count">
548 <xsl:call-template name="gentext">
549 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
550 </xsl:call-template>
551 </xsl:attribute>
552
553 <xsl:apply-templates select="$part" mode="running.head.mode">
554 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
555 </xsl:apply-templates>
556
557 <xsl:apply-templates select="$part" mode="running.foot.mode">
558 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
559 </xsl:apply-templates>
560
561 <fo:flow flow-name="xsl-region-body">
562 <xsl:call-template name="set.flow.properties">
563 <xsl:with-param name="element" select="local-name(.)"/>
564 <xsl:with-param name="master-reference"
565 select="$lot-master-reference"/>
566 </xsl:call-template>
567
568 <xsl:call-template name="division.toc">
569 <xsl:with-param name="toc-context" select="$part"/>
570 <xsl:with-param name="toc.title.p"
571 select="contains($toc.params, 'title')"/>
572 </xsl:call-template>
573
574 </fo:flow>
575 </fo:page-sequence>
576 </xsl:if>
577</xsl:template>
578
579<!-- ==================================================================== -->
580
581<xsl:template match="part/partintro">
582 <xsl:apply-templates select=".." mode="part.titlepage.mode">
583 <xsl:with-param name="additional.content">
584 <xsl:if test="title">
585 <xsl:call-template name="partintro.titlepage"/>
586 </xsl:if>
587 <xsl:apply-templates/>
588 </xsl:with-param>
589 </xsl:apply-templates>
590
591 <xsl:call-template name="generate.part.toc">
592 <xsl:with-param name="part" select=".."/>
593 </xsl:call-template>
594</xsl:template>
595
596<xsl:template match="partintro/title"></xsl:template>
597<xsl:template match="partintro/subtitle"></xsl:template>
598<xsl:template match="partintro/titleabbrev"></xsl:template>
599
600<!-- ==================================================================== -->
601
602<xsl:template match="book" mode="division.number">
603 <xsl:number from="set" count="book" format="1."/>
604</xsl:template>
605
606<xsl:template match="part" mode="division.number">
607 <xsl:number from="book" count="part" format="I."/>
608</xsl:template>
609
610</xsl:stylesheet>
611
Note: See TracBrowser for help on using the repository browser.