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 8320 2009-03-12 17:43:44Z mzjn $
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"/>
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"/>
38 <fo:block keep-with-next.within-column="always"
40 <xsl:if test="$axf.extensions != 0">
41 <xsl:attribute name="axf:outline-level">
43 <xsl:when test="count($node/ancestor::*) > 0">
44 <xsl:value-of select="count($node/ancestor::*)"/>
46 <xsl:otherwise>1</xsl:otherwise>
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)"/>
54 <xsl:copy-of select="$title"/>
58 <!-- ==================================================================== -->
60 <xsl:template match="set">
61 <xsl:variable name="id">
62 <xsl:call-template name="object.id"/>
65 <xsl:variable name="preamble"
66 select="*[not(self::book or self::set or self::setindex)]"/>
68 <xsl:variable name="content" select="book|set|setindex"/>
70 <xsl:variable name="titlepage-master-reference">
71 <xsl:call-template name="select.pagemaster">
72 <xsl:with-param name="pageclass" select="'titlepage'"/>
76 <xsl:variable name="lot-master-reference">
77 <xsl:call-template name="select.pagemaster">
78 <xsl:with-param name="pageclass" select="'lot'"/>
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"/>
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"/>
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"/>
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"/>
109 <xsl:attribute name="hyphenation-character">
110 <xsl:call-template name="gentext">
111 <xsl:with-param name="key" select="'hyphenation-character'"/>
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'"/>
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'"/>
125 <xsl:apply-templates select="." mode="running.head.mode">
126 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
127 </xsl:apply-templates>
129 <xsl:apply-templates select="." mode="running.foot.mode">
130 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
131 </xsl:apply-templates>
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"/>
140 <fo:block id="{$id}">
141 <xsl:call-template name="set.titlepage"/>
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)"/>
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"/>
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"/>
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"/>
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"/>
179 <xsl:attribute name="hyphenation-character">
180 <xsl:call-template name="gentext">
181 <xsl:with-param name="key" select="'hyphenation-character'"/>
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'"/>
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'"/>
195 <xsl:apply-templates select="." mode="running.head.mode">
196 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
197 </xsl:apply-templates>
199 <xsl:apply-templates select="." mode="running.foot.mode">
200 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
201 </xsl:apply-templates>
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"/>
210 <xsl:call-template name="set.toc"/>
215 <xsl:apply-templates select="$content"/>
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>
223 <!-- ==================================================================== -->
225 <xsl:template match="book">
226 <xsl:variable name="id">
227 <xsl:call-template name="object.id"/>
230 <xsl:variable name="preamble"
231 select="title|subtitle|titleabbrev|bookinfo|info"/>
233 <xsl:variable name="content"
234 select="node()[not(self::title or self::subtitle
237 or self::bookinfo)]"/>
239 <xsl:variable name="titlepage-master-reference">
240 <xsl:call-template name="select.pagemaster">
241 <xsl:with-param name="pageclass" select="'titlepage'"/>
245 <xsl:call-template name="front.cover"/>
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"/>
259 <xsl:apply-templates select="dedication" mode="dedication"/>
260 <xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
262 <xsl:call-template name="make.book.tocs"/>
264 <xsl:apply-templates select="$content"/>
266 <xsl:call-template name="back.cover"/>
270 <xsl:template match="book/bookinfo"></xsl:template>
271 <xsl:template match="book/info"></xsl:template>
272 <xsl:template match="book/title"></xsl:template>
273 <xsl:template match="book/subtitle"></xsl:template>
274 <xsl:template match="book/titleabbrev"></xsl:template>
276 <!-- Placeholder templates -->
277 <xsl:template name="front.cover"/>
278 <xsl:template name="back.cover"/>
280 <!-- ================================================================= -->
281 <xsl:template name="make.book.tocs">
283 <xsl:variable name="lot-master-reference">
284 <xsl:call-template name="select.pagemaster">
285 <xsl:with-param name="pageclass" select="'lot'"/>
289 <xsl:variable name="toc.params">
290 <xsl:call-template name="find.path.params">
291 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
295 <xsl:if test="contains($toc.params, 'toc')">
296 <xsl:call-template name="page.sequence">
297 <xsl:with-param name="master-reference"
298 select="$lot-master-reference"/>
299 <xsl:with-param name="element" select="'toc'"/>
300 <xsl:with-param name="gentext-key" select="'TableofContents'"/>
301 <xsl:with-param name="content">
302 <xsl:call-template name="division.toc">
303 <xsl:with-param name="toc.title.p"
304 select="contains($toc.params, 'title')"/>
310 <xsl:if test="contains($toc.params,'figure') and .//figure">
311 <xsl:call-template name="page.sequence">
312 <xsl:with-param name="master-reference"
313 select="$lot-master-reference"/>
314 <xsl:with-param name="element" select="'toc'"/>
315 <xsl:with-param name="gentext-key" select="'ListofFigures'"/>
316 <xsl:with-param name="content">
317 <xsl:call-template name="list.of.titles">
318 <xsl:with-param name="titles" select="'figure'"/>
319 <xsl:with-param name="nodes" select=".//figure"/>
325 <xsl:if test="contains($toc.params,'table') and .//table">
326 <xsl:call-template name="page.sequence">
327 <xsl:with-param name="master-reference"
328 select="$lot-master-reference"/>
329 <xsl:with-param name="element" select="'toc'"/>
330 <xsl:with-param name="gentext-key" select="'ListofTables'"/>
331 <xsl:with-param name="content">
332 <xsl:call-template name="list.of.titles">
333 <xsl:with-param name="titles" select="'table'"/>
334 <xsl:with-param name="nodes" select=".//table"/>
340 <xsl:if test="contains($toc.params,'example') and .//example">
341 <xsl:call-template name="page.sequence">
342 <xsl:with-param name="master-reference"
343 select="$lot-master-reference"/>
344 <xsl:with-param name="element" select="'toc'"/>
345 <xsl:with-param name="gentext-key" select="'ListofExample'"/>
346 <xsl:with-param name="content">
347 <xsl:call-template name="list.of.titles">
348 <xsl:with-param name="titles" select="'example'"/>
349 <xsl:with-param name="nodes" select=".//example"/>
355 <xsl:if test="contains($toc.params,'equation') and
356 .//equation[title or info/title]">
357 <xsl:call-template name="page.sequence">
358 <xsl:with-param name="master-reference"
359 select="$lot-master-reference"/>
360 <xsl:with-param name="element" select="'toc'"/>
361 <xsl:with-param name="gentext-key" select="'ListofEquations'"/>
362 <xsl:with-param name="content">
363 <xsl:call-template name="list.of.titles">
364 <xsl:with-param name="titles" select="'equation'"/>
365 <xsl:with-param name="nodes"
366 select=".//equation[title or info/title]"/>
372 <xsl:if test="contains($toc.params,'procedure') and
373 .//procedure[title or info/title]">
374 <xsl:call-template name="page.sequence">
375 <xsl:with-param name="master-reference"
376 select="$lot-master-reference"/>
377 <xsl:with-param name="element" select="'toc'"/>
378 <xsl:with-param name="gentext-key" select="'ListofProcedures'"/>
379 <xsl:with-param name="content">
380 <xsl:call-template name="list.of.titles">
381 <xsl:with-param name="titles" select="'procedure'"/>
382 <xsl:with-param name="nodes"
383 select=".//procedure[title or info/title]"/>
389 <!-- ==================================================================== -->
391 <xsl:template match="part">
392 <xsl:if test="not(partintro)">
393 <xsl:apply-templates select="." mode="part.titlepage.mode"/>
394 <xsl:call-template name="generate.part.toc"/>
396 <xsl:apply-templates/>
399 <xsl:template match="part" mode="part.titlepage.mode">
400 <!-- done this way to force the context node to be the part -->
401 <xsl:param name="additional.content"/>
403 <xsl:variable name="id">
404 <xsl:call-template name="object.id"/>
407 <xsl:variable name="titlepage-master-reference">
408 <xsl:call-template name="select.pagemaster">
409 <xsl:with-param name="pageclass" select="'titlepage'"/>
413 <fo:page-sequence hyphenate="{$hyphenate}"
414 master-reference="{$titlepage-master-reference}">
415 <xsl:attribute name="language">
416 <xsl:call-template name="l10n.language"/>
418 <xsl:attribute name="format">
419 <xsl:call-template name="page.number.format">
420 <xsl:with-param name="master-reference"
421 select="$titlepage-master-reference"/>
425 <xsl:attribute name="initial-page-number">
426 <xsl:call-template name="initial.page.number">
427 <xsl:with-param name="master-reference"
428 select="$titlepage-master-reference"/>
432 <xsl:attribute name="force-page-count">
433 <xsl:call-template name="force.page.count">
434 <xsl:with-param name="master-reference"
435 select="$titlepage-master-reference"/>
439 <xsl:attribute name="hyphenation-character">
440 <xsl:call-template name="gentext">
441 <xsl:with-param name="key" select="'hyphenation-character'"/>
444 <xsl:attribute name="hyphenation-push-character-count">
445 <xsl:call-template name="gentext">
446 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
449 <xsl:attribute name="hyphenation-remain-character-count">
450 <xsl:call-template name="gentext">
451 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
455 <xsl:apply-templates select="." mode="running.head.mode">
456 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
457 </xsl:apply-templates>
459 <xsl:apply-templates select="." mode="running.foot.mode">
460 <xsl:with-param name="master-reference" select="$titlepage-master-reference"/>
461 </xsl:apply-templates>
463 <fo:flow flow-name="xsl-region-body">
464 <xsl:call-template name="set.flow.properties">
465 <xsl:with-param name="element" select="local-name(.)"/>
466 <xsl:with-param name="master-reference"
467 select="$titlepage-master-reference"/>
470 <fo:block id="{$id}">
471 <xsl:call-template name="part.titlepage"/>
473 <xsl:copy-of select="$additional.content"/>
478 <xsl:template match="part/docinfo|partinfo"></xsl:template>
479 <xsl:template match="part/info"></xsl:template>
480 <xsl:template match="part/title"></xsl:template>
481 <xsl:template match="part/subtitle"></xsl:template>
482 <xsl:template match="part/titleabbrev"></xsl:template>
484 <!-- ==================================================================== -->
486 <xsl:template name="generate.part.toc">
487 <xsl:param name="part" select="."/>
489 <xsl:variable name="lot-master-reference">
490 <xsl:call-template name="select.pagemaster">
491 <xsl:with-param name="pageclass" select="'lot'"/>
495 <xsl:variable name="toc.params">
496 <xsl:call-template name="find.path.params">
497 <xsl:with-param name="node" select="$part"/>
498 <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
502 <xsl:variable name="nodes" select="reference|
511 <xsl:if test="count($nodes) > 0 and contains($toc.params, 'toc')">
512 <fo:page-sequence hyphenate="{$hyphenate}"
513 master-reference="{$lot-master-reference}">
514 <xsl:attribute name="language">
515 <xsl:call-template name="l10n.language"/>
517 <xsl:attribute name="format">
518 <xsl:call-template name="page.number.format">
519 <xsl:with-param name="element" select="'toc'"/>
520 <xsl:with-param name="master-reference"
521 select="$lot-master-reference"/>
524 <xsl:attribute name="initial-page-number">
525 <xsl:call-template name="initial.page.number">
526 <xsl:with-param name="element" select="'toc'"/>
527 <xsl:with-param name="master-reference"
528 select="$lot-master-reference"/>
531 <xsl:attribute name="force-page-count">
532 <xsl:call-template name="force.page.count">
533 <xsl:with-param name="master-reference"
534 select="$lot-master-reference"/>
538 <xsl:attribute name="hyphenation-character">
539 <xsl:call-template name="gentext">
540 <xsl:with-param name="key" select="'hyphenation-character'"/>
543 <xsl:attribute name="hyphenation-push-character-count">
544 <xsl:call-template name="gentext">
545 <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
548 <xsl:attribute name="hyphenation-remain-character-count">
549 <xsl:call-template name="gentext">
550 <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
554 <xsl:apply-templates select="$part" mode="running.head.mode">
555 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
556 </xsl:apply-templates>
558 <xsl:apply-templates select="$part" mode="running.foot.mode">
559 <xsl:with-param name="master-reference" select="$lot-master-reference"/>
560 </xsl:apply-templates>
562 <fo:flow flow-name="xsl-region-body">
563 <xsl:call-template name="set.flow.properties">
564 <xsl:with-param name="element" select="local-name(.)"/>
565 <xsl:with-param name="master-reference"
566 select="$lot-master-reference"/>
569 <xsl:call-template name="division.toc">
570 <xsl:with-param name="toc-context" select="$part"/>
571 <xsl:with-param name="toc.title.p"
572 select="contains($toc.params, 'title')"/>
580 <!-- ==================================================================== -->
582 <xsl:template match="part/partintro">
583 <xsl:apply-templates select=".." mode="part.titlepage.mode">
584 <xsl:with-param name="additional.content">
585 <xsl:if test="title">
586 <xsl:call-template name="partintro.titlepage"/>
588 <xsl:apply-templates/>
590 </xsl:apply-templates>
592 <xsl:call-template name="generate.part.toc">
593 <xsl:with-param name="part" select=".."/>
597 <xsl:template match="partintro/title"></xsl:template>
598 <xsl:template match="partintro/subtitle"></xsl:template>
599 <xsl:template match="partintro/titleabbrev"></xsl:template>
601 <!-- ==================================================================== -->
603 <xsl:template match="book" mode="division.number">
604 <xsl:number from="set" count="book" format="1."/>
607 <xsl:template match="part" mode="division.number">
608 <xsl:number from="book" count="part" format="I."/>