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 9730 2013-03-15 15:26:25Z 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">
35 <xsl:attribute name="axf:outline-level">
37 <xsl:when test="count($node/ancestor::*) > 0">
38 <xsl:value-of select="count($node/ancestor::*)"/>
40 <xsl:otherwise>1</xsl:otherwise>
43 <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
44 <xsl:attribute name="axf:outline-title">
45 <xsl:value-of select="normalize-space($title)"/>
48 <xsl:copy-of select="$title"/>
52 <!-- ==================================================================== -->
54 <xsl:template match="set">
55 <xsl:variable name="id">
56 <xsl:call-template name="object.id"/>
59 <xsl:variable name="preamble"
60 select="*[not(self::book or self::set or self::setindex)]"/>
62 <xsl:variable name="content" select="book|set|setindex"/>
64 <xsl:variable name="titlepage-master-reference">
65 <xsl:call-template name="select.pagemaster">
66 <xsl:with-param name="pageclass" select="'titlepage'"/>
70 <xsl:variable name="lot-master-reference">
71 <xsl:call-template name="select.pagemaster">
72 <xsl:with-param name="pageclass" select="'lot'"/>
76 <xsl:if test="$preamble">
77 <fo:page-sequence hyphenate="{$hyphenate}"
78 master-reference="{$titlepage-master-reference}">
79 <xsl:attribute name="language">
80 <xsl:call-template name="l10n.language"/>
82 <xsl:attribute name="format">
83 <xsl:call-template name="page.number.format">
84 <xsl:with-param name="master-reference"
85 select="$titlepage-master-reference"/>
89 <xsl:attribute name="initial-page-number">
90 <xsl:call-template name="initial.page.number">
91 <xsl:with-param name="master-reference"
92 select="$titlepage-master-reference"/>
96 <xsl:attribute name="force-page-count">
97 <xsl:call-template name="force.page.count">
98 <xsl:with-param name="master-reference"
99 select="$titlepage-master-reference"/>
103 <xsl:attribute name="hyphenation-character">
104 <xsl:call-template name="gentext">
105 <xsl:with-param name="key" select="'hyphenation-character'"/>
108 <xsl:attribute name="hyphenation-push-character-count">
109 <xsl:call-template name="gentext">
110 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
113 <xsl:attribute name="hyphenation-remain-character-count">
114 <xsl:call-template name="gentext">
115 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
119 <xsl:apply-templates select="." mode="running.head.mode">
120 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
121 </xsl:apply-templates>
123 <xsl:apply-templates select="." mode="running.foot.mode">
124 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
125 </xsl:apply-templates>
127 <fo:flow flow-name="xsl-region-body">
128 <xsl:call-template name="set.flow.properties">
129 <xsl:with-param name="element" select="local-name(.)"/>
130 <xsl:with-param name="master-reference"
131 select="$titlepage-master-reference"/>
134 <fo:block id="{$id}">
135 <xsl:call-template name="set.titlepage"/>
141 <xsl:variable name="toc.params">
142 <xsl:call-template name="find.path.params">
143 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
147 <xsl:if test="contains($toc.params, 'toc')">
148 <fo:page-sequence hyphenate="{$hyphenate}"
149 master-reference="{$lot-master-reference}">
150 <xsl:attribute name="language">
151 <xsl:call-template name="l10n.language"/>
153 <xsl:attribute name="format">
154 <xsl:call-template name="page.number.format">
155 <xsl:with-param name="element" select="'toc'"/>
156 <xsl:with-param name="master-reference"
157 select="$lot-master-reference"/>
160 <xsl:attribute name="initial-page-number">
161 <xsl:call-template name="initial.page.number">
162 <xsl:with-param name="master-reference"
163 select="$lot-master-reference"/>
166 <xsl:attribute name="force-page-count">
167 <xsl:call-template name="force.page.count">
168 <xsl:with-param name="master-reference"
169 select="$lot-master-reference"/>
173 <xsl:attribute name="hyphenation-character">
174 <xsl:call-template name="gentext">
175 <xsl:with-param name="key" select="'hyphenation-character'"/>
178 <xsl:attribute name="hyphenation-push-character-count">
179 <xsl:call-template name="gentext">
180 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
183 <xsl:attribute name="hyphenation-remain-character-count">
184 <xsl:call-template name="gentext">
185 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
189 <xsl:apply-templates select="." mode="running.head.mode">
190 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
191 </xsl:apply-templates>
193 <xsl:apply-templates select="." mode="running.foot.mode">
194 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
195 </xsl:apply-templates>
197 <fo:flow flow-name="xsl-region-body">
198 <xsl:call-template name="set.flow.properties">
199 <xsl:with-param name="element" select="local-name(.)"/>
200 <xsl:with-param name="master-reference"
201 select="$lot-master-reference"/>
204 <xsl:call-template name="set.toc"/>
209 <xsl:apply-templates select="$content"/>
212 <xsl:template match="set/setinfo"></xsl:template>
213 <xsl:template match="set/title"></xsl:template>
214 <xsl:template match="set/subtitle"></xsl:template>
215 <xsl:template match="set/titleabbrev"></xsl:template>
217 <!-- ==================================================================== -->
219 <xsl:template match="book">
220 <xsl:variable name="id">
221 <xsl:call-template name="object.id"/>
224 <xsl:variable name="preamble"
225 select="title|subtitle|titleabbrev|bookinfo|info"/>
227 <xsl:variable name="content"
228 select="node()[not(self::title or self::subtitle
231 or self::bookinfo)]"/>
233 <xsl:variable name="titlepage-master-reference">
234 <xsl:call-template name="select.pagemaster">
235 <xsl:with-param name="pageclass" select="'titlepage'"/>
239 <xsl:call-template name="front.cover"/>
241 <xsl:if test="$preamble">
242 <xsl:call-template name="page.sequence">
243 <xsl:with-param name="master-reference"
244 select="$titlepage-master-reference"/>
245 <xsl:with-param name="content">
246 <fo:block id="{$id}">
247 <xsl:call-template name="book.titlepage"/>
253 <xsl:apply-templates select="dedication" mode="dedication"/>
254 <xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
256 <xsl:call-template name="make.book.tocs"/>
258 <xsl:apply-templates select="$content"/>
260 <xsl:call-template name="back.cover"/>
264 <xsl:template match="book/bookinfo"></xsl:template>
265 <xsl:template match="book/info"></xsl:template>
266 <xsl:template match="book/title"></xsl:template>
267 <xsl:template match="book/subtitle"></xsl:template>
268 <xsl:template match="book/titleabbrev"></xsl:template>
270 <!-- Placeholder templates -->
271 <xsl:template name="front.cover"/>
272 <xsl:template name="back.cover"/>
274 <!-- ================================================================= -->
275 <xsl:template name="make.book.tocs">
277 <xsl:variable name="lot-master-reference">
278 <xsl:call-template name="select.pagemaster">
279 <xsl:with-param name="pageclass" select="'lot'"/>
283 <xsl:variable name="toc.params">
284 <xsl:call-template name="find.path.params">
285 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
289 <xsl:if test="contains($toc.params, 'toc')">
290 <xsl:call-template name="page.sequence">
291 <xsl:with-param name="master-reference"
292 select="$lot-master-reference"/>
293 <xsl:with-param name="element" select="'toc'"/>
294 <xsl:with-param name="gentext-key" select="'TableofContents'"/>
295 <xsl:with-param name="content">
296 <xsl:call-template name="division.toc">
297 <xsl:with-param name="toc.title.p"
298 select="contains($toc.params, 'title')"/>
304 <xsl:if test="contains($toc.params,'figure') and .//figure">
305 <xsl:call-template name="page.sequence">
306 <xsl:with-param name="master-reference"
307 select="$lot-master-reference"/>
308 <xsl:with-param name="element" select="'toc'"/>
309 <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
310 <xsl:with-param name="content">
311 <xsl:call-template name="list.of.titles">
312 <xsl:with-param name="titles" select="'figure'"/>
313 <xsl:with-param name="nodes" select=".//figure"/>
319 <xsl:if test="contains($toc.params,'table') and .//table">
320 <xsl:call-template name="page.sequence">
321 <xsl:with-param name="master-reference"
322 select="$lot-master-reference"/>
323 <xsl:with-param name="element" select="'toc'"/>
324 <xsl:with-param name="gentext-key" select="'ListofTables'"/>
325 <xsl:with-param name="content">
326 <xsl:call-template name="list.of.titles">
327 <xsl:with-param name="titles" select="'table'"/>
328 <xsl:with-param name="nodes" select=".//table[not(@tocentry = 0)]"/>
334 <xsl:if test="contains($toc.params,'example') and .//example">
335 <xsl:call-template name="page.sequence">
336 <xsl:with-param name="master-reference"
337 select="$lot-master-reference"/>
338 <xsl:with-param name="element" select="'toc'"/>
339 <xsl:with-param name="gentext-key" select="'ListofExample'"/>
340 <xsl:with-param name="content">
341 <xsl:call-template name="list.of.titles">
342 <xsl:with-param name="titles" select="'example'"/>
343 <xsl:with-param name="nodes" select=".//example"/>
349 <xsl:if test="contains($toc.params,'equation') and
350 .//equation[title or info/title]">
351 <xsl:call-template name="page.sequence">
352 <xsl:with-param name="master-reference"
353 select="$lot-master-reference"/>
354 <xsl:with-param name="element" select="'toc'"/>
355 <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
356 <xsl:with-param name="content">
357 <xsl:call-template name="list.of.titles">
358 <xsl:with-param name="titles" select="'equation'"/>
359 <xsl:with-param name="nodes"
360 select=".//equation[title or info/title]"/>
366 <xsl:if test="contains($toc.params,'procedure') and
367 .//procedure[title or info/title]">
368 <xsl:call-template name="page.sequence">
369 <xsl:with-param name="master-reference"
370 select="$lot-master-reference"/>
371 <xsl:with-param name="element" select="'toc'"/>
372 <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
373 <xsl:with-param name="content">
374 <xsl:call-template name="list.of.titles">
375 <xsl:with-param name="titles" select="'procedure'"/>
376 <xsl:with-param name="nodes"
377 select=".//procedure[title or info/title]"/>
383 <!-- ==================================================================== -->
385 <xsl:template match="part">
386 <xsl:if test="not(partintro)">
387 <xsl:apply-templates select="." mode="part.titlepage.mode"/>
388 <xsl:call-template name="generate.part.toc"/>
390 <xsl:apply-templates/>
393 <xsl:template match="part" mode="part.titlepage.mode">
394 <!-- done this way to force the context node to be the part -->
395 <xsl:param name="additional.content"/>
397 <xsl:variable name="id">
398 <xsl:call-template name="object.id"/>
401 <xsl:variable name="titlepage-master-reference">
402 <xsl:call-template name="select.pagemaster">
403 <xsl:with-param name="pageclass" select="'titlepage'"/>
407 <fo:page-sequence hyphenate="{$hyphenate}"
408 master-reference="{$titlepage-master-reference}">
409 <xsl:attribute name="language">
410 <xsl:call-template name="l10n.language"/>
412 <xsl:attribute name="format">
413 <xsl:call-template name="page.number.format">
414 <xsl:with-param name="master-reference"
415 select="$titlepage-master-reference"/>
419 <xsl:attribute name="initial-page-number">
420 <xsl:call-template name="initial.page.number">
421 <xsl:with-param name="master-reference"
422 select="$titlepage-master-reference"/>
426 <xsl:attribute name="force-page-count">
427 <xsl:call-template name="force.page.count">
428 <xsl:with-param name="master-reference"
429 select="$titlepage-master-reference"/>
433 <xsl:attribute name="hyphenation-character">
434 <xsl:call-template name="gentext">
435 <xsl:with-param name="key" select="'hyphenation-character'"/>
438 <xsl:attribute name="hyphenation-push-character-count">
439 <xsl:call-template name="gentext">
440 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
443 <xsl:attribute name="hyphenation-remain-character-count">
444 <xsl:call-template name="gentext">
445 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
449 <xsl:apply-templates select="." mode="running.head.mode">
450 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
451 </xsl:apply-templates>
453 <xsl:apply-templates select="." mode="running.foot.mode">
454 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
455 </xsl:apply-templates>
457 <fo:flow flow-name="xsl-region-body">
458 <xsl:call-template name="set.flow.properties">
459 <xsl:with-param name="element" select="local-name(.)"/>
460 <xsl:with-param name="master-reference"
461 select="$titlepage-master-reference"/>
464 <fo:block id="{$id}">
465 <xsl:call-template name="part.titlepage"/>
467 <xsl:copy-of select="$additional.content"/>
472 <xsl:template match="part/docinfo|partinfo"></xsl:template>
473 <xsl:template match="part/info"></xsl:template>
474 <xsl:template match="part/title"></xsl:template>
475 <xsl:template match="part/subtitle"></xsl:template>
476 <xsl:template match="part/titleabbrev"></xsl:template>
478 <!-- ==================================================================== -->
480 <xsl:template name="generate.part.toc">
481 <xsl:param name="part" select="."/>
483 <xsl:variable name="lot-master-reference">
484 <xsl:call-template name="select.pagemaster">
485 <xsl:with-param name="pageclass" select="'lot'"/>
489 <xsl:variable name="toc.params">
490 <xsl:call-template name="find.path.params">
491 <xsl:with-param name="node" select="$part"/>
492 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
496 <xsl:variable name="nodes" select="$part/reference|
505 <xsl:if test="count($nodes) > 0 and contains($toc.params, 'toc')">
506 <fo:page-sequence hyphenate="{$hyphenate}"
507 master-reference="{$lot-master-reference}">
508 <xsl:attribute name="language">
509 <xsl:call-template name="l10n.language"/>
511 <xsl:attribute name="format">
512 <xsl:call-template name="page.number.format">
513 <xsl:with-param name="element" select="'toc'"/>
514 <xsl:with-param name="master-reference"
515 select="$lot-master-reference"/>
518 <xsl:attribute name="initial-page-number">
519 <xsl:call-template name="initial.page.number">
520 <xsl:with-param name="element" select="'toc'"/>
521 <xsl:with-param name="master-reference"
522 select="$lot-master-reference"/>
525 <xsl:attribute name="force-page-count">
526 <xsl:call-template name="force.page.count">
527 <xsl:with-param name="master-reference"
528 select="$lot-master-reference"/>
532 <xsl:attribute name="hyphenation-character">
533 <xsl:call-template name="gentext">
534 <xsl:with-param name="key" select="'hyphenation-character'"/>
537 <xsl:attribute name="hyphenation-push-character-count">
538 <xsl:call-template name="gentext">
539 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
542 <xsl:attribute name="hyphenation-remain-character-count">
543 <xsl:call-template name="gentext">
544 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
548 <xsl:apply-templates select="$part" mode="running.head.mode">
549 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
550 </xsl:apply-templates>
552 <xsl:apply-templates select="$part" mode="running.foot.mode">
553 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
554 </xsl:apply-templates>
556 <fo:flow flow-name="xsl-region-body">
557 <xsl:call-template name="set.flow.properties">
558 <xsl:with-param name="element" select="local-name(.)"/>
559 <xsl:with-param name="master-reference"
560 select="$lot-master-reference"/>
563 <xsl:call-template name="division.toc">
564 <xsl:with-param name="toc-context" select="$part"/>
565 <xsl:with-param name="toc.title.p"
566 select="contains($toc.params, 'title')"/>
574 <!-- ==================================================================== -->
576 <xsl:template match="part/partintro">
577 <xsl:apply-templates select=".." mode="part.titlepage.mode">
578 <xsl:with-param name="additional.content">
579 <xsl:if test="title">
580 <xsl:call-template name="partintro.titlepage"/>
582 <xsl:apply-templates/>
584 </xsl:apply-templates>
586 <xsl:call-template name="generate.part.toc">
587 <xsl:with-param name="part" select=".."/>
591 <xsl:template match="partintro/title"></xsl:template>
592 <xsl:template match="partintro/subtitle"></xsl:template>
593 <xsl:template match="partintro/titleabbrev"></xsl:template>
595 <!-- ==================================================================== -->
597 <xsl:template match="book" mode="division.number">
598 <xsl:number from="set" count="book" format="1."/>
601 <xsl:template match="part" mode="division.number">
602 <xsl:number from="book" count="part" format="I."/>