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="component.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="object.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="2"
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<xsl:template name="component.subtitle">
44  <xsl:param name="node" select="."/>
45  <xsl:variable name="subtitle">
46    <xsl:apply-templates select="$node" mode="subtitle.markup"/>
47  </xsl:variable>
48
49  <xsl:if test="$subtitle != ''">
50    <fo:block font-size="16pt"
51              font-weight="bold"
52              font-style="italic"
53              keep-with-next.within-column="always"
54              hyphenate="false">
55      <xsl:copy-of select="$subtitle"/>
56    </fo:block>
57  </xsl:if>
58</xsl:template>
59
60<xsl:template name="component.separator">
61</xsl:template>
62
63<!-- ==================================================================== -->
64
65<xsl:template match="dedication" mode="dedication">
66  <xsl:variable name="id">
67    <xsl:call-template name="object.id"/>
68  </xsl:variable>
69  <xsl:variable name="master-name">
70    <xsl:call-template name="select.pagemaster"/>
71  </xsl:variable>
72
73  <fo:page-sequence id="{$id}"
74                    hyphenate="{$hyphenate}"
75                    format="i"
76                    master-name="{$master-name}">
77    <xsl:attribute name="language">
78      <xsl:call-template name="l10n.language"/>
79    </xsl:attribute>
80    <xsl:if test="$double.sided != 0">
81      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
82    </xsl:if>
83
84    <xsl:apply-templates select="." mode="running.head.mode">
85      <xsl:with-param name="master-name" select="$master-name"/>
86    </xsl:apply-templates>
87    <xsl:apply-templates select="." mode="running.foot.mode">
88      <xsl:with-param name="master-name" select="$master-name"/>
89    </xsl:apply-templates>
90
91    <fo:flow flow-name="xsl-region-body">
92      <xsl:call-template name="dedication.titlepage"/>
93      <xsl:apply-templates/>
94    </fo:flow>
95  </fo:page-sequence>
96</xsl:template>
97
98<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" -->
99<xsl:template match="dedication/docinfo"></xsl:template>
100<xsl:template match="dedication/title"></xsl:template>
101<xsl:template match="dedication/subtitle"></xsl:template>
102<xsl:template match="dedication/titleabbrev"></xsl:template>
103
104<!-- ==================================================================== -->
105
106<xsl:template match="preface">
107  <xsl:variable name="id">
108    <xsl:call-template name="object.id"/>
109  </xsl:variable>
110  <xsl:variable name="master-name">
111    <xsl:call-template name="select.pagemaster"/>
112  </xsl:variable>
113
114  <fo:page-sequence id="{$id}"
115                    hyphenate="{$hyphenate}"
116                    format="i"
117                    master-name="{$master-name}">
118    <xsl:attribute name="language">
119      <xsl:call-template name="l10n.language"/>
120    </xsl:attribute>
121    <xsl:if test="$double.sided != 0">
122      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
123    </xsl:if>
124
125    <xsl:apply-templates select="." mode="running.head.mode">
126      <xsl:with-param name="master-name" select="$master-name"/>
127    </xsl:apply-templates>
128    <xsl:apply-templates select="." mode="running.foot.mode">
129      <xsl:with-param name="master-name" select="$master-name"/>
130    </xsl:apply-templates>
131
132    <fo:flow flow-name="xsl-region-body">
133      <xsl:call-template name="component.separator"/>
134      <xsl:call-template name="preface.titlepage"/>
135      <xsl:if test="$generate.component.toc">
136        <xsl:call-template name="component.toc"/>
137      </xsl:if>
138      <xsl:apply-templates/>
139    </fo:flow>
140  </fo:page-sequence>
141</xsl:template>
142
143<xsl:template match="preface/docinfo"></xsl:template>
144<xsl:template match="preface/title"></xsl:template>
145<xsl:template match="preface/titleabbrev"></xsl:template>
146<xsl:template match="preface/subtitle"></xsl:template>
147
148<xsl:template match="chapter">
149  <xsl:variable name="id">
150    <xsl:call-template name="object.id"/>
151  </xsl:variable>
152  <xsl:variable name="master-name">
153    <xsl:call-template name="select.pagemaster"/>
154  </xsl:variable>
155
156  <fo:page-sequence id="{$id}"
157                    hyphenate="{$hyphenate}"
158                    master-name="{$master-name}">
159    <xsl:attribute name="language">
160      <xsl:call-template name="l10n.language"/>
161    </xsl:attribute>
162    <xsl:if test="not(preceding::chapter)">
163      <xsl:attribute name="initial-page-number">1</xsl:attribute>
164    </xsl:if>
165    <xsl:if test="$double.sided != 0">
166      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
167    </xsl:if>
168
169    <xsl:apply-templates select="." mode="running.head.mode">
170      <xsl:with-param name="master-name" select="$master-name"/>
171    </xsl:apply-templates>
172    <xsl:apply-templates select="." mode="running.foot.mode">
173      <xsl:with-param name="master-name" select="$master-name"/>
174    </xsl:apply-templates>
175
176    <fo:flow flow-name="xsl-region-body">
177      <xsl:call-template name="component.separator"/>
178      <xsl:call-template name="chapter.titlepage"/>
179      <xsl:if test="$generate.component.toc">
180        <xsl:call-template name="component.toc"/>
181      </xsl:if>
182      <xsl:apply-templates/>
183    </fo:flow>
184  </fo:page-sequence>
185</xsl:template>
186
187<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template>
188<xsl:template match="chapter/title"></xsl:template>
189<xsl:template match="chapter/titleabbrev"></xsl:template>
190<xsl:template match="chapter/subtitle"></xsl:template>
191
192<xsl:template match="appendix">
193  <xsl:variable name="id">
194    <xsl:call-template name="object.id"/>
195  </xsl:variable>
196  <xsl:variable name="master-name">
197    <xsl:call-template name="select.pagemaster"/>
198  </xsl:variable>
199
200  <fo:page-sequence id="{$id}"
201                    hyphenate="{$hyphenate}"
202                    master-name="{$master-name}">
203    <xsl:attribute name="language">
204      <xsl:call-template name="l10n.language"/>
205    </xsl:attribute>
206    <xsl:if test="$double.sided != 0">
207      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
208    </xsl:if>
209
210    <xsl:apply-templates select="." mode="running.head.mode">
211      <xsl:with-param name="master-name" select="$master-name"/>
212    </xsl:apply-templates>
213    <xsl:apply-templates select="." mode="running.foot.mode">
214      <xsl:with-param name="master-name" select="$master-name"/>
215    </xsl:apply-templates>
216
217    <fo:flow flow-name="xsl-region-body">
218      <xsl:call-template name="component.separator"/>
219      <xsl:call-template name="appendix.titlepage"/>
220      <xsl:if test="$generate.component.toc">
221        <xsl:call-template name="component.toc"/>
222      </xsl:if>
223      <xsl:apply-templates/>
224    </fo:flow>
225  </fo:page-sequence>
226</xsl:template>
227
228<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template>
229<xsl:template match="appendix/title"></xsl:template>
230<xsl:template match="appendix/titleabbrev"></xsl:template>
231<xsl:template match="appendix/subtitle"></xsl:template>
232
233<!-- ==================================================================== -->
234
235<xsl:template match="dedication" mode="component.number">
236  <xsl:param name="add.space" select="false()"/>
237</xsl:template>
238
239<xsl:template match="preface" mode="component.number">
240  <xsl:param name="add.space" select="false()"/>
241</xsl:template>
242
243<xsl:template match="chapter" mode="component.number">
244  <xsl:param name="add.space" select="false()"/>
245  <xsl:choose>
246    <xsl:when test="@label">
247      <xsl:value-of select="@label"/>
248      <xsl:text>.</xsl:text>
249      <xsl:if test="$add.space">
250        <xsl:call-template name="gentext.space"/>
251      </xsl:if>
252    </xsl:when>
253    <xsl:when test="$chapter.autolabel">
254      <xsl:number from="book" count="chapter" format="1."/>
255      <xsl:if test="$add.space">
256        <xsl:call-template name="gentext.space"/>
257      </xsl:if>
258    </xsl:when>
259    <xsl:otherwise></xsl:otherwise>
260  </xsl:choose>
261</xsl:template>
262
263<xsl:template match="appendix" mode="component.number">
264  <xsl:param name="add.space" select="false()"/>
265  <xsl:choose>
266    <xsl:when test="@label">
267      <xsl:value-of select="@label"/>
268      <xsl:text>.</xsl:text>
269      <xsl:if test="$add.space">
270        <xsl:call-template name="gentext.space"/>
271      </xsl:if>
272    </xsl:when>
273    <xsl:when test="$chapter.autolabel">
274      <xsl:number from="book" count="appendix" format="A."/>
275      <xsl:if test="$add.space">
276        <xsl:call-template name="gentext.space"/>
277      </xsl:if>
278    </xsl:when>
279    <xsl:otherwise></xsl:otherwise>
280  </xsl:choose>
281</xsl:template>
282
283<xsl:template match="article" mode="component.number">
284  <xsl:param name="add.space" select="false()"/>
285</xsl:template>
286
287<xsl:template match="bibliography" mode="component.number">
288  <xsl:param name="add.space" select="false()"/>
289</xsl:template>
290
291<xsl:template match="glossary" mode="component.number">
292  <xsl:param name="add.space" select="false()"/>
293</xsl:template>
294
295<xsl:template match="index" mode="component.number">
296  <xsl:param name="add.space" select="false()"/>
297</xsl:template>
298
299<!-- ==================================================================== -->
300
301<xsl:template match="article">
302  <xsl:variable name="id">
303    <xsl:call-template name="object.id"/>
304  </xsl:variable>
305  <xsl:variable name="master-name">
306    <xsl:call-template name="select.pagemaster"/>
307  </xsl:variable>
308
309  <fo:page-sequence id="{$id}"
310                    hyphenate="{$hyphenate}"
311                    master-name="{$master-name}">
312    <xsl:attribute name="language">
313      <xsl:call-template name="l10n.language"/>
314    </xsl:attribute>
315    <xsl:if test="$double.sided != 0">
316      <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
317    </xsl:if>
318
319    <xsl:apply-templates select="." mode="running.head.mode">
320      <xsl:with-param name="master-name" select="$master-name"/>
321    </xsl:apply-templates>
322    <xsl:apply-templates select="." mode="running.foot.mode">
323      <xsl:with-param name="master-name" select="$master-name"/>
324    </xsl:apply-templates>
325
326    <fo:flow flow-name="xsl-region-body">
327      <xsl:call-template name="article.titlepage"/>
328      <xsl:if test="$generate.component.toc">
329        <xsl:call-template name="component.toc"/>
330      </xsl:if>
331      <xsl:apply-templates/>
332    </fo:flow>
333  </fo:page-sequence>
334</xsl:template>
335
336<xsl:template match="article/artheader"></xsl:template>
337<xsl:template match="article/articleinfo"></xsl:template>
338<xsl:template match="article/title"></xsl:template>
339<xsl:template match="article/subtitle"></xsl:template>
340
341<xsl:template match="article/appendix">
342  <xsl:variable name="id">
343    <xsl:call-template name="object.id"/>
344  </xsl:variable>
345
346  <fo:block id='{$id}'>
347    <xsl:call-template name="section.heading">
348      <xsl:with-param name="level" select="2"/>
349      <xsl:with-param name="title">
350        <xsl:apply-templates select="." mode="title.markup"/>
351      </xsl:with-param>
352    </xsl:call-template>
353
354    <xsl:apply-templates/>
355  </fo:block>
356</xsl:template>
357
358<!-- ==================================================================== -->
359
360</xsl:stylesheet>
361
362