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                version='1.0'>
5
6<!-- ********************************************************************
7     $Id$
8     ********************************************************************
9
10     This file is part of the XSL DocBook Stylesheet distribution.
11     See /README or http://nwalsh.com/docbook/xsl/ for copyright
12     and other information.
13
14     ******************************************************************** -->
15
16<!-- ==================================================================== -->
17
18<xsl:template name="division.title">
19  <xsl:param name="node" select="."/>
20  <xsl:variable name="id">
21    <xsl:call-template name="object.id">
22      <xsl:with-param name="object" select="$node"/>
23    </xsl:call-template>
24  </xsl:variable>
25  <xsl:variable name="title">
26    <xsl:apply-templates select="$node" mode="title.markup"/>
27  </xsl:variable>
28
29  <xsl:if test="$passivetex.extensions != 0">
30    <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
31                    fotex-bookmark-level="1"
32                    fotex-bookmark-label="{$id}">
33      <xsl:value-of select="$title"/>
34    </fotex:bookmark>
35  </xsl:if>
36
37  <fo:block keep-with-next.within-column="always"
38            hyphenate="false">
39    <xsl:copy-of select="$title"/>
40  </fo:block>
41</xsl:template>
42
43<!-- ==================================================================== -->
44
45<xsl:template match="set">
46  <xsl:variable name="preamble"
47                select="*[not(self::book or self::setindex)]"/>
48  <xsl:variable name="content" select="book|setindex"/>
49
50  <xsl:variable name="id">
51    <xsl:call-template name="object.id"/>
52  </xsl:variable>
53  <xsl:variable name="master-name">
54    <xsl:call-template name="select.pagemaster"/>
55  </xsl:variable>
56
57  <xsl:if test="$preamble">
58    <fo:page-sequence id="{$id}"
59                      hyphenate="{$hyphenate}"
60                      master-name="{$master-name}">
61      <xsl:attribute name="language">
62        <xsl:call-template name="l10n.language"/>
63      </xsl:attribute>
64      <xsl:if test="$double.sided != 0">
65        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
66      </xsl:if>
67
68      <xsl:apply-templates select="." mode="running.head.mode">
69        <xsl:with-param name="master-name" select="$master-name"/>
70      </xsl:apply-templates>
71      <xsl:apply-templates select="." mode="running.foot.mode">
72        <xsl:with-param name="master-name" select="$master-name"/>
73      </xsl:apply-templates>
74      <fo:flow flow-name="xsl-region-body">
75        <xsl:call-template name="set.titlepage"/>
76      </fo:flow>
77    </fo:page-sequence>
78  </xsl:if>
79
80  <xsl:apply-templates select="$content"/>
81</xsl:template>
82
83<xsl:template match="set/setinfo"></xsl:template>
84<xsl:template match="set/title"></xsl:template>
85<xsl:template match="set/subtitle"></xsl:template>
86
87<!-- ==================================================================== -->
88
89<xsl:template match="book">
90  <xsl:variable name="preamble"
91                select="title|subtitle|titleabbrev|bookinfo"/>
92  <xsl:variable name="content"
93                select="*[not(self::title or self::subtitle
94                            or self::titleabbrev
95                            or self::bookinfo)]"/>
96  <xsl:variable name="id">
97    <xsl:call-template name="object.id"/>
98  </xsl:variable>
99  <xsl:variable name="master-name">
100    <xsl:call-template name="select.pagemaster"/>
101  </xsl:variable>
102
103  <xsl:if test="$preamble">
104    <fo:page-sequence id="{$id}"
105                      hyphenate="{$hyphenate}"
106                      master-name="{$master-name}">
107      <xsl:attribute name="language">
108        <xsl:call-template name="l10n.language"/>
109      </xsl:attribute>
110      <xsl:if test="$double.sided != 0">
111        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
112      </xsl:if>
113
114      <xsl:apply-templates select="." mode="running.head.mode">
115        <xsl:with-param name="master-name" select="$master-name"/>
116      </xsl:apply-templates>
117      <xsl:apply-templates select="." mode="running.foot.mode">
118        <xsl:with-param name="master-name" select="$master-name"/>
119      </xsl:apply-templates>
120      <fo:flow flow-name="xsl-region-body">
121        <xsl:call-template name="book.titlepage"/>
122      </fo:flow>
123    </fo:page-sequence>
124  </xsl:if>
125
126  <xsl:if test="$generate.book.toc != '0'">
127    <fo:page-sequence hyphenate="{$hyphenate}"
128                      format="i"
129                      master-name="{$master-name}">
130      <xsl:attribute name="language">
131        <xsl:call-template name="l10n.language"/>
132      </xsl:attribute>
133      <xsl:if test="$double.sided != 0">
134        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
135      </xsl:if>
136
137      <xsl:apply-templates select="." mode="running.head.mode">
138        <xsl:with-param name="master-name" select="$master-name"/>
139      </xsl:apply-templates>
140      <xsl:apply-templates select="." mode="running.foot.mode">
141        <xsl:with-param name="master-name" select="$master-name"/>
142      </xsl:apply-templates>
143      <fo:flow flow-name="xsl-region-body">
144        <xsl:call-template name="division.toc"/>
145      </fo:flow>
146    </fo:page-sequence>
147  </xsl:if>
148
149  <xsl:if test="$generate.book.figure.lot != '0' and .//figure">
150    <fo:page-sequence hyphenate="{$hyphenate}"
151                      format="i"
152                      master-name="{$master-name}">
153      <xsl:attribute name="language">
154        <xsl:call-template name="l10n.language"/>
155      </xsl:attribute>
156      <xsl:if test="$double.sided != 0">
157        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
158      </xsl:if>
159
160      <xsl:apply-templates select="." mode="running.head.mode">
161        <xsl:with-param name="master-name" select="$master-name"/>
162      </xsl:apply-templates>
163      <xsl:apply-templates select="." mode="running.foot.mode">
164        <xsl:with-param name="master-name" select="$master-name"/>
165      </xsl:apply-templates>
166      <fo:flow flow-name="xsl-region-body">
167        <xsl:call-template name="list.of.titles">
168          <xsl:with-param name="titles" select="'figure'"/>
169          <xsl:with-param name="nodes" select=".//figure"/>
170        </xsl:call-template>
171      </fo:flow>
172    </fo:page-sequence>
173  </xsl:if>
174
175  <xsl:if test="$generate.book.table.lot != '0' and .//table">
176    <fo:page-sequence hyphenate="{$hyphenate}"
177                      format="i"
178                      master-name="{$master-name}">
179      <xsl:attribute name="language">
180        <xsl:call-template name="l10n.language"/>
181      </xsl:attribute>
182      <xsl:if test="$double.sided != 0">
183        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
184      </xsl:if>
185
186      <xsl:apply-templates select="." mode="running.head.mode">
187        <xsl:with-param name="master-name" select="$master-name"/>
188      </xsl:apply-templates>
189      <xsl:apply-templates select="." mode="running.foot.mode">
190        <xsl:with-param name="master-name" select="$master-name"/>
191      </xsl:apply-templates>
192      <fo:flow flow-name="xsl-region-body">
193        <xsl:call-template name="list.of.titles">
194          <xsl:with-param name="titles" select="'table'"/>
195          <xsl:with-param name="nodes" select=".//table"/>
196        </xsl:call-template>
197      </fo:flow>
198    </fo:page-sequence>
199  </xsl:if>
200
201  <xsl:if test="$generate.book.example.lot != '0' and .//example">
202    <fo:page-sequence hyphenate="{$hyphenate}"
203                      format="i"
204                      master-name="{$master-name}">
205      <xsl:attribute name="language">
206        <xsl:call-template name="l10n.language"/>
207      </xsl:attribute>
208      <xsl:if test="$double.sided != 0">
209        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
210      </xsl:if>
211
212      <xsl:apply-templates select="." mode="running.head.mode">
213        <xsl:with-param name="master-name" select="$master-name"/>
214      </xsl:apply-templates>
215      <xsl:apply-templates select="." mode="running.foot.mode">
216        <xsl:with-param name="master-name" select="$master-name"/>
217      </xsl:apply-templates>
218      <fo:flow flow-name="xsl-region-body">
219        <xsl:call-template name="list.of.titles">
220          <xsl:with-param name="titles" select="'example'"/>
221          <xsl:with-param name="nodes" select=".//example"/>
222        </xsl:call-template>
223      </fo:flow>
224    </fo:page-sequence>
225  </xsl:if>
226
227  <xsl:if test="$generate.book.equation.lot != '0' and .//equation">
228    <fo:page-sequence hyphenate="{$hyphenate}"
229                      format="i"
230                      master-name="{$master-name}">
231      <xsl:attribute name="language">
232        <xsl:call-template name="l10n.language"/>
233      </xsl:attribute>
234      <xsl:if test="$double.sided != 0">
235        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
236      </xsl:if>
237
238      <xsl:apply-templates select="." mode="running.head.mode">
239        <xsl:with-param name="master-name" select="$master-name"/>
240      </xsl:apply-templates>
241      <xsl:apply-templates select="." mode="running.foot.mode">
242        <xsl:with-param name="master-name" select="$master-name"/>
243      </xsl:apply-templates>
244      <fo:flow flow-name="xsl-region-body">
245        <xsl:call-template name="list.of.titles">
246          <xsl:with-param name="titles" select="'equation'"/>
247          <xsl:with-param name="nodes" select=".//equation"/>
248        </xsl:call-template>
249      </fo:flow>
250    </fo:page-sequence>
251  </xsl:if>
252
253  <xsl:apply-templates select="dedication" mode="dedication"/>
254
255  <xsl:apply-templates select="$content"/>
256</xsl:template>
257
258<xsl:template match="book/bookinfo"></xsl:template>
259<xsl:template match="book/title"></xsl:template>
260<xsl:template match="book/subtitle"></xsl:template>
261
262<!-- ==================================================================== -->
263
264<xsl:template match="part">
265  <xsl:if test="not(partintro)">
266    <xsl:variable name="id">
267      <xsl:call-template name="object.id"/>
268    </xsl:variable>
269    <xsl:variable name="master-name">
270      <xsl:call-template name="select.pagemaster"/>
271    </xsl:variable>
272
273    <fo:page-sequence id="{$id}"
274                      hyphenate="{$hyphenate}"
275                      master-name="{$master-name}">
276      <xsl:attribute name="language">
277        <xsl:call-template name="l10n.language"/>
278      </xsl:attribute>
279      <xsl:if test="$double.sided != 0">
280        <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
281      </xsl:if>
282
283      <xsl:apply-templates select="." mode="running.head.mode">
284        <xsl:with-param name="master-name" select="$master-name"/>
285      </xsl:apply-templates>
286      <xsl:apply-templates select="." mode="running.foot.mode">
287        <xsl:with-param name="master-name" select="$master-name"/>
288      </xsl:apply-templates>
289
290      <fo:flow flow-name="xsl-region-body">
291        <xsl:call-template name="part.titlepage"/>
292      </fo:flow>
293    </fo:page-sequence>
294  </xsl:if>
295  <xsl:apply-templates/>
296</xsl:template>
297
298<xsl:template match="part" mode="part.titlepage.mode">
299  <!-- done this way to force the context node to be the part -->
300  <xsl:call-template name="part.titlepage"/>
301</xsl:template>
302
303<xsl:template match="part/docinfo|partinfo"></xsl:template>
304<xsl:template match="part/title"></xsl:template>
305<xsl:template match="part/subtitle"></xsl:template>
306
307<xsl:template match="part/partintro">
308  <xsl:variable name="id">
309    <xsl:call-template name="object.id">
310      <xsl:with-param name="object" select="ancestor::part"/>
311    </xsl:call-template>
312  </xsl:variable>
313  <xsl:variable name="master-name">
314    <xsl:call-template name="select.pagemaster"/>
315  </xsl:variable>
316
317  <fo:page-sequence id="{$id}"
318                    hyphenate="{$hyphenate}"
319                    master-name="{$master-name}">
320    <xsl:attribute name="language">
321      <xsl:call-template name="l10n.language"/>
322    </xsl:attribute>
323    <xsl:if test="$double.sided != 0">
324      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
325    </xsl:if>
326
327    <xsl:apply-templates select="." mode="running.head.mode">
328      <xsl:with-param name="master-name" select="$master-name"/>
329    </xsl:apply-templates>
330    <xsl:apply-templates select="." mode="running.foot.mode">
331      <xsl:with-param name="master-name" select="$master-name"/>
332    </xsl:apply-templates>
333
334    <fo:flow flow-name="xsl-region-body">
335      <xsl:apply-templates select=".." mode="part.titlepage.mode"/>
336      <xsl:if test="title">
337        <xsl:call-template name="partintro.titlepage"/>
338      </xsl:if>
339      <xsl:apply-templates/>
340    </fo:flow>
341  </fo:page-sequence>
342</xsl:template>
343
344<xsl:template match="partintro/title"></xsl:template>
345<xsl:template match="partintro/subtitle"></xsl:template>
346<xsl:template match="partintro/titleabbrev"></xsl:template>
347
348<!-- ==================================================================== -->
349
350<xsl:template match="book" mode="division.number">
351  <xsl:number from="set" count="book" format="1."/>
352</xsl:template>
353
354<xsl:template match="part" mode="division.number">
355  <xsl:number from="book" count="part" format="I."/>
356</xsl:template>
357
358</xsl:stylesheet>
359
360