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"
7 <!-- ********************************************************************
8 $Id: division.xsl 9841 2014-01-07 22:31:09Z bobstayton $
9 ********************************************************************
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.
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="set">
57 <xsl:variable name="id">
58 <xsl:call-template name="object.id"/>
61 <xsl:variable name="preamble"
62 select="*[not(self::book or self::set or self::setindex)]"/>
64 <xsl:variable name="content" select="book|set|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="set/setinfo"></xsl:template>
215 <xsl:template match="set/title"></xsl:template>
216 <xsl:template match="set/subtitle"></xsl:template>
217 <xsl:template match="set/titleabbrev"></xsl:template>
219 <!-- ==================================================================== -->
221 <xsl:template match="book">
222 <xsl:variable name="id">
223 <xsl:call-template name="object.id"/>
226 <xsl:variable name="preamble"
227 select="title|subtitle|titleabbrev|bookinfo|info"/>
229 <xsl:variable name="content"
230 select="node()[not(self::title or self::subtitle
233 or self::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="dedication" mode="dedication"/>
256 <xsl:apply-templates select="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="book/bookinfo"></xsl:template>
267 <xsl:template match="book/info"></xsl:template>
268 <xsl:template match="book/title"></xsl:template>
269 <xsl:template match="book/subtitle"></xsl:template>
270 <xsl:template match="book/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 .//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=".//figure"/>
321 <xsl:if test="contains($toc.params,'table') and .//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=".//table[not(@tocentry = 0)]"/>
336 <xsl:if test="contains($toc.params,'example') and .//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=".//example"/>
351 <xsl:if test="contains($toc.params,'equation') and
352 .//equation[title or info/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=".//equation[title or info/title]"/>
368 <xsl:if test="contains($toc.params,'procedure') and
369 .//procedure[title or info/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=".//procedure[title or info/title]"/>
385 <!-- ==================================================================== -->
387 <xsl:template match="part">
388 <xsl:if test="not(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="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="part/docinfo|partinfo"></xsl:template>
475 <xsl:template match="part/info"></xsl:template>
476 <xsl:template match="part/title"></xsl:template>
477 <xsl:template match="part/subtitle"></xsl:template>
478 <xsl:template match="part/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/reference|
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="part/partintro">
579 <xsl:apply-templates select=".." mode="part.titlepage.mode">
580 <xsl:with-param name="additional.content">
581 <xsl:if test="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="partintro/title"></xsl:template>
594 <xsl:template match="partintro/subtitle"></xsl:template>
595 <xsl:template match="partintro/titleabbrev"></xsl:template>
597 <!-- ==================================================================== -->
599 <xsl:template match="book" mode="division.number">
600 <xsl:number from="set" count="book" format="1."/>
603 <xsl:template match="part" mode="division.number">
604 <xsl:number from="book" count="part" format="I."/>
607 <!-- ==================================================================== -->