2 <xsl:stylesheet exclude-result-prefixes="d"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:d="http://docbook.org/ns/docbook"
5 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
9 <!-- ********************************************************************
11 This file is part of the XSL DocBook Stylesheet distribution.
12 See ../README or http://cdn.docbook.org/release/xsl/current/ for
13 copyright and other information.
15 ******************************************************************** -->
17 <!-- ==================================================================== -->
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"/>
26 <xsl:variable name="title">
27 <xsl:apply-templates select="$node" mode="object.title.markup">
28 <xsl:with-param name="allow-anchors" select="1"/>
29 </xsl:apply-templates>
32 <fo:block keep-with-next.within-column="always"
34 <xsl:if test="$axf.extensions != 0 and
35 $xsl1.1.bookmarks = 0 and
36 $show.bookmarks != 0">
37 <xsl:attribute name="axf:outline-level">
39 <xsl:when test="count($node/ancestor::*) > 0">
40 <xsl:value-of select="count($node/ancestor::*)"/>
42 <xsl:otherwise>1</xsl:otherwise>
45 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
46 <xsl:attribute name="axf:outline-title">
47 <xsl:value-of select="normalize-space($title)"/>
50 <xsl:copy-of select="$title"/>
54 <!-- ==================================================================== -->
56 <xsl:template match="d:set">
57 <xsl:variable name="id">
58 <xsl:call-template name="object.id"/>
61 <xsl:variable name="preamble"
62 select="*[not(self::d:book or self::d:set or self::d:setindex)]"/>
64 <xsl:variable name="content" select="d:book|d:set|d:setindex"/>
66 <xsl:variable name="titlepage-master-reference">
67 <xsl:call-template name="select.pagemaster">
68 <xsl:with-param name="pageclass" select="'titlepage'"/>
72 <xsl:variable name="lot-master-reference">
73 <xsl:call-template name="select.pagemaster">
74 <xsl:with-param name="pageclass" select="'lot'"/>
78 <xsl:if test="$preamble">
79 <fo:page-sequence hyphenate="{$hyphenate}"
80 master-reference="{$titlepage-master-reference}">
81 <xsl:attribute name="language">
82 <xsl:call-template name="l10n.language"/>
84 <xsl:attribute name="format">
85 <xsl:call-template name="page.number.format">
86 <xsl:with-param name="master-reference"
87 select="$titlepage-master-reference"/>
91 <xsl:attribute name="initial-page-number">
92 <xsl:call-template name="initial.page.number">
93 <xsl:with-param name="master-reference"
94 select="$titlepage-master-reference"/>
98 <xsl:attribute name="force-page-count">
99 <xsl:call-template name="force.page.count">
100 <xsl:with-param name="master-reference"
101 select="$titlepage-master-reference"/>
105 <xsl:attribute name="hyphenation-character">
106 <xsl:call-template name="gentext">
107 <xsl:with-param name="key" select="'hyphenation-character'"/>
110 <xsl:attribute name="hyphenation-push-character-count">
111 <xsl:call-template name="gentext">
112 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
115 <xsl:attribute name="hyphenation-remain-character-count">
116 <xsl:call-template name="gentext">
117 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
121 <xsl:apply-templates select="." mode="running.head.mode">
122 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
123 </xsl:apply-templates>
125 <xsl:apply-templates select="." mode="running.foot.mode">
126 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
127 </xsl:apply-templates>
129 <fo:flow flow-name="xsl-region-body">
130 <xsl:call-template name="set.flow.properties">
131 <xsl:with-param name="element" select="local-name(.)"/>
132 <xsl:with-param name="master-reference"
133 select="$titlepage-master-reference"/>
136 <fo:block id="{$id}">
137 <xsl:call-template name="set.titlepage"/>
143 <xsl:variable name="toc.params">
144 <xsl:call-template name="find.path.params">
145 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
149 <xsl:if test="contains($toc.params, 'toc')">
150 <fo:page-sequence hyphenate="{$hyphenate}"
151 master-reference="{$lot-master-reference}">
152 <xsl:attribute name="language">
153 <xsl:call-template name="l10n.language"/>
155 <xsl:attribute name="format">
156 <xsl:call-template name="page.number.format">
157 <xsl:with-param name="element" select="'toc'"/>
158 <xsl:with-param name="master-reference"
159 select="$lot-master-reference"/>
162 <xsl:attribute name="initial-page-number">
163 <xsl:call-template name="initial.page.number">
164 <xsl:with-param name="master-reference"
165 select="$lot-master-reference"/>
168 <xsl:attribute name="force-page-count">
169 <xsl:call-template name="force.page.count">
170 <xsl:with-param name="master-reference"
171 select="$lot-master-reference"/>
175 <xsl:attribute name="hyphenation-character">
176 <xsl:call-template name="gentext">
177 <xsl:with-param name="key" select="'hyphenation-character'"/>
180 <xsl:attribute name="hyphenation-push-character-count">
181 <xsl:call-template name="gentext">
182 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
185 <xsl:attribute name="hyphenation-remain-character-count">
186 <xsl:call-template name="gentext">
187 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
191 <xsl:apply-templates select="." mode="running.head.mode">
192 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
193 </xsl:apply-templates>
195 <xsl:apply-templates select="." mode="running.foot.mode">
196 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
197 </xsl:apply-templates>
199 <fo:flow flow-name="xsl-region-body">
200 <xsl:call-template name="set.flow.properties">
201 <xsl:with-param name="element" select="local-name(.)"/>
202 <xsl:with-param name="master-reference"
203 select="$lot-master-reference"/>
206 <xsl:call-template name="set.toc"/>
211 <xsl:apply-templates select="$content"/>
214 <xsl:template match="d:set/d:setinfo"></xsl:template>
215 <xsl:template match="d:set/d:title"></xsl:template>
216 <xsl:template match="d:set/d:subtitle"></xsl:template>
217 <xsl:template match="d:set/d:titleabbrev"></xsl:template>
219 <!-- ==================================================================== -->
221 <xsl:template match="d:book">
222 <xsl:variable name="id">
223 <xsl:call-template name="object.id"/>
226 <xsl:variable name="preamble"
227 select="d:title|d:subtitle|d:titleabbrev|d:bookinfo|d:info"/>
229 <xsl:variable name="content"
230 select="node()[not(self::d:title or self::d:subtitle
231 or self::d:titleabbrev
233 or self::d:bookinfo)]"/>
235 <xsl:variable name="titlepage-master-reference">
236 <xsl:call-template name="select.pagemaster">
237 <xsl:with-param name="pageclass" select="'titlepage'"/>
241 <xsl:call-template name="front.cover"/>
243 <xsl:if test="$preamble">
244 <xsl:call-template name="page.sequence">
245 <xsl:with-param name="master-reference"
246 select="$titlepage-master-reference"/>
247 <xsl:with-param name="content">
248 <fo:block id="{$id}">
249 <xsl:call-template name="book.titlepage"/>
255 <xsl:apply-templates select="d:dedication" mode="dedication"/>
256 <xsl:apply-templates select="d:acknowledgements" mode="acknowledgements"/>
258 <xsl:call-template name="make.book.tocs"/>
260 <xsl:apply-templates select="$content"/>
262 <xsl:call-template name="back.cover"/>
266 <xsl:template match="d:book/d:bookinfo"></xsl:template>
267 <xsl:template match="d:book/d:info"></xsl:template>
268 <xsl:template match="d:book/d:title"></xsl:template>
269 <xsl:template match="d:book/d:subtitle"></xsl:template>
270 <xsl:template match="d:book/d:titleabbrev"></xsl:template>
272 <!-- Placeholder templates -->
273 <xsl:template name="front.cover"/>
274 <xsl:template name="back.cover"/>
276 <!-- ================================================================= -->
277 <xsl:template name="make.book.tocs">
279 <xsl:variable name="lot-master-reference">
280 <xsl:call-template name="select.pagemaster">
281 <xsl:with-param name="pageclass" select="'lot'"/>
285 <xsl:variable name="toc.params">
286 <xsl:call-template name="find.path.params">
287 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
291 <xsl:if test="contains($toc.params, 'toc')">
292 <xsl:call-template name="page.sequence">
293 <xsl:with-param name="master-reference"
294 select="$lot-master-reference"/>
295 <xsl:with-param name="element" select="'toc'"/>
296 <xsl:with-param name="gentext-key" select="'TableofContents'"/>
297 <xsl:with-param name="content">
298 <xsl:call-template name="division.toc">
299 <xsl:with-param name="toc.title.p"
300 select="contains($toc.params, 'title')"/>
306 <xsl:if test="contains($toc.params,'figure') and .//d:figure">
307 <xsl:call-template name="page.sequence">
308 <xsl:with-param name="master-reference"
309 select="$lot-master-reference"/>
310 <xsl:with-param name="element" select="'toc'"/>
311 <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
312 <xsl:with-param name="content">
313 <xsl:call-template name="list.of.titles">
314 <xsl:with-param name="titles" select="'figure'"/>
315 <xsl:with-param name="nodes" select=".//d:figure"/>
321 <xsl:if test="contains($toc.params,'table') and .//d:table">
322 <xsl:call-template name="page.sequence">
323 <xsl:with-param name="master-reference"
324 select="$lot-master-reference"/>
325 <xsl:with-param name="element" select="'toc'"/>
326 <xsl:with-param name="gentext-key" select="'ListofTables'"/>
327 <xsl:with-param name="content">
328 <xsl:call-template name="list.of.titles">
329 <xsl:with-param name="titles" select="'table'"/>
330 <xsl:with-param name="nodes" select=".//d:table[not(@tocentry = 0)]"/>
336 <xsl:if test="contains($toc.params,'example') and .//d:example">
337 <xsl:call-template name="page.sequence">
338 <xsl:with-param name="master-reference"
339 select="$lot-master-reference"/>
340 <xsl:with-param name="element" select="'toc'"/>
341 <xsl:with-param name="gentext-key" select="'ListofExample'"/>
342 <xsl:with-param name="content">
343 <xsl:call-template name="list.of.titles">
344 <xsl:with-param name="titles" select="'example'"/>
345 <xsl:with-param name="nodes" select=".//d:example"/>
351 <xsl:if test="contains($toc.params,'equation') and
352 .//d:equation[d:title or d:info/d:title]">
353 <xsl:call-template name="page.sequence">
354 <xsl:with-param name="master-reference"
355 select="$lot-master-reference"/>
356 <xsl:with-param name="element" select="'toc'"/>
357 <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
358 <xsl:with-param name="content">
359 <xsl:call-template name="list.of.titles">
360 <xsl:with-param name="titles" select="'equation'"/>
361 <xsl:with-param name="nodes"
362 select=".//d:equation[d:title or d:info/d:title]"/>
368 <xsl:if test="contains($toc.params,'procedure') and
369 .//d:procedure[d:title or d:info/d:title]">
370 <xsl:call-template name="page.sequence">
371 <xsl:with-param name="master-reference"
372 select="$lot-master-reference"/>
373 <xsl:with-param name="element" select="'toc'"/>
374 <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
375 <xsl:with-param name="content">
376 <xsl:call-template name="list.of.titles">
377 <xsl:with-param name="titles" select="'procedure'"/>
378 <xsl:with-param name="nodes"
379 select=".//d:procedure[d:title or d:info/d:title]"/>
385 <!-- ==================================================================== -->
387 <xsl:template match="d:part">
388 <xsl:if test="not(d:partintro)">
389 <xsl:apply-templates select="." mode="part.titlepage.mode"/>
390 <xsl:call-template name="generate.part.toc"/>
392 <xsl:apply-templates/>
395 <xsl:template match="d:part" mode="part.titlepage.mode">
396 <!-- done this way to force the context node to be the part -->
397 <xsl:param name="additional.content"/>
399 <xsl:variable name="id">
400 <xsl:call-template name="object.id"/>
403 <xsl:variable name="titlepage-master-reference">
404 <xsl:call-template name="select.pagemaster">
405 <xsl:with-param name="pageclass" select="'titlepage'"/>
409 <fo:page-sequence hyphenate="{$hyphenate}"
410 master-reference="{$titlepage-master-reference}">
411 <xsl:attribute name="language">
412 <xsl:call-template name="l10n.language"/>
414 <xsl:attribute name="format">
415 <xsl:call-template name="page.number.format">
416 <xsl:with-param name="master-reference"
417 select="$titlepage-master-reference"/>
421 <xsl:attribute name="initial-page-number">
422 <xsl:call-template name="initial.page.number">
423 <xsl:with-param name="master-reference"
424 select="$titlepage-master-reference"/>
428 <xsl:attribute name="force-page-count">
429 <xsl:call-template name="force.page.count">
430 <xsl:with-param name="master-reference"
431 select="$titlepage-master-reference"/>
435 <xsl:attribute name="hyphenation-character">
436 <xsl:call-template name="gentext">
437 <xsl:with-param name="key" select="'hyphenation-character'"/>
440 <xsl:attribute name="hyphenation-push-character-count">
441 <xsl:call-template name="gentext">
442 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
445 <xsl:attribute name="hyphenation-remain-character-count">
446 <xsl:call-template name="gentext">
447 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
451 <xsl:apply-templates select="." mode="running.head.mode">
452 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
453 </xsl:apply-templates>
455 <xsl:apply-templates select="." mode="running.foot.mode">
456 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
457 </xsl:apply-templates>
459 <fo:flow flow-name="xsl-region-body">
460 <xsl:call-template name="set.flow.properties">
461 <xsl:with-param name="element" select="local-name(.)"/>
462 <xsl:with-param name="master-reference"
463 select="$titlepage-master-reference"/>
466 <fo:block id="{$id}">
467 <xsl:call-template name="part.titlepage"/>
469 <xsl:copy-of select="$additional.content"/>
474 <xsl:template match="d:part/d:docinfo|d:partinfo"></xsl:template>
475 <xsl:template match="d:part/d:info"></xsl:template>
476 <xsl:template match="d:part/d:title"></xsl:template>
477 <xsl:template match="d:part/d:subtitle"></xsl:template>
478 <xsl:template match="d:part/d:titleabbrev"></xsl:template>
480 <!-- ==================================================================== -->
482 <xsl:template name="generate.part.toc">
483 <xsl:param name="part" select="."/>
485 <xsl:variable name="lot-master-reference">
486 <xsl:call-template name="select.pagemaster">
487 <xsl:with-param name="pageclass" select="'lot'"/>
491 <xsl:variable name="toc.params">
492 <xsl:call-template name="find.path.params">
493 <xsl:with-param name="node" select="$part"/>
494 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
498 <xsl:variable name="nodes" select="$part/d:reference|
503 $part/d:bibliography|
507 <xsl:if test="count($nodes) > 0 and contains($toc.params, 'toc')">
508 <fo:page-sequence hyphenate="{$hyphenate}"
509 master-reference="{$lot-master-reference}">
510 <xsl:attribute name="language">
511 <xsl:call-template name="l10n.language"/>
513 <xsl:attribute name="format">
514 <xsl:call-template name="page.number.format">
515 <xsl:with-param name="element" select="'toc'"/>
516 <xsl:with-param name="master-reference"
517 select="$lot-master-reference"/>
520 <xsl:attribute name="initial-page-number">
521 <xsl:call-template name="initial.page.number">
522 <xsl:with-param name="element" select="'toc'"/>
523 <xsl:with-param name="master-reference"
524 select="$lot-master-reference"/>
527 <xsl:attribute name="force-page-count">
528 <xsl:call-template name="force.page.count">
529 <xsl:with-param name="master-reference"
530 select="$lot-master-reference"/>
534 <xsl:attribute name="hyphenation-character">
535 <xsl:call-template name="gentext">
536 <xsl:with-param name="key" select="'hyphenation-character'"/>
539 <xsl:attribute name="hyphenation-push-character-count">
540 <xsl:call-template name="gentext">
541 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
544 <xsl:attribute name="hyphenation-remain-character-count">
545 <xsl:call-template name="gentext">
546 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
550 <xsl:apply-templates select="$part" mode="running.head.mode">
551 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
552 </xsl:apply-templates>
554 <xsl:apply-templates select="$part" mode="running.foot.mode">
555 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
556 </xsl:apply-templates>
558 <fo:flow flow-name="xsl-region-body">
559 <xsl:call-template name="set.flow.properties">
560 <xsl:with-param name="element" select="local-name(.)"/>
561 <xsl:with-param name="master-reference"
562 select="$lot-master-reference"/>
565 <xsl:call-template name="division.toc">
566 <xsl:with-param name="toc-context" select="$part"/>
567 <xsl:with-param name="toc.title.p"
568 select="contains($toc.params, 'title')"/>
576 <!-- ==================================================================== -->
578 <xsl:template match="d:part/d:partintro">
579 <xsl:apply-templates select=".." mode="part.titlepage.mode">
580 <xsl:with-param name="additional.content">
581 <xsl:if test="d:title">
582 <xsl:call-template name="partintro.titlepage"/>
584 <xsl:apply-templates/>
586 </xsl:apply-templates>
588 <xsl:call-template name="generate.part.toc">
589 <xsl:with-param name="part" select=".."/>
593 <xsl:template match="d:partintro/d:title"></xsl:template>
594 <xsl:template match="d:partintro/d:subtitle"></xsl:template>
595 <xsl:template match="d:partintro/d:titleabbrev"></xsl:template>
597 <!-- ==================================================================== -->
599 <xsl:template match="d:book" mode="division.number">
600 <xsl:number from="d:set" count="d:book" format="1."/>
603 <xsl:template match="d:part" mode="division.number">
604 <xsl:number from="d:book" count="d:part" format="I."/>
607 <!-- ==================================================================== -->