Imported Upstream version 1.79.2
[platform/upstream/docbook-xsl-stylesheets.git] / fo / component.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet exclude-result-prefixes="d"
3                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4                 xmlns:d="http://docbook.org/ns/docbook"
5                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6                 xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
7                 version='1.0'>
8
9 <!-- ********************************************************************
10
11      This file is part of the XSL DocBook Stylesheet distribution.
12      See ../README or http://cdn.docbook.org/release/xsl/current/ for
13      copyright and other information.
14
15      ******************************************************************** -->
16
17 <!-- ==================================================================== -->
18
19
20 <xsl:template name="component.title">
21   <xsl:param name="node" select="."/>
22   <xsl:param name="pagewide" select="0"/>
23
24   <xsl:variable name="id">
25     <xsl:call-template name="object.id">
26       <xsl:with-param name="object" select="$node"/>
27     </xsl:call-template>
28   </xsl:variable>
29
30   <xsl:variable name="title">
31     <xsl:apply-templates select="$node" mode="object.title.markup">
32       <xsl:with-param name="allow-anchors" select="1"/>
33     </xsl:apply-templates>
34   </xsl:variable>
35
36   <xsl:variable name="titleabbrev">
37     <xsl:apply-templates select="$node" mode="titleabbrev.markup"/>
38   </xsl:variable>
39
40   <xsl:variable name="level">
41     <xsl:choose>
42       <xsl:when test="ancestor::d:section">
43         <xsl:value-of select="count(ancestor::d:section)+1"/>
44       </xsl:when>
45       <xsl:when test="ancestor::d:sect5">6</xsl:when>
46       <xsl:when test="ancestor::d:sect4">5</xsl:when>
47       <xsl:when test="ancestor::d:sect3">4</xsl:when>
48       <xsl:when test="ancestor::d:sect2">3</xsl:when>
49       <xsl:when test="ancestor::d:sect1">2</xsl:when>
50       <xsl:otherwise>1</xsl:otherwise>
51     </xsl:choose>
52   </xsl:variable>
53
54   <fo:block xsl:use-attribute-sets="component.title.properties">
55     <xsl:if test="$pagewide != 0">
56       <!-- Doesn't work to use 'all' here since not a child of fo:flow -->
57       <xsl:attribute name="span">inherit</xsl:attribute>
58     </xsl:if>
59     <xsl:attribute name="hyphenation-character">
60       <xsl:call-template name="gentext">
61         <xsl:with-param name="key" select="'hyphenation-character'"/>
62       </xsl:call-template>
63     </xsl:attribute>
64     <xsl:attribute name="hyphenation-push-character-count">
65       <xsl:call-template name="gentext">
66         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
67       </xsl:call-template>
68     </xsl:attribute>
69     <xsl:attribute name="hyphenation-remain-character-count">
70       <xsl:call-template name="gentext">
71         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
72       </xsl:call-template>
73     </xsl:attribute>
74     <xsl:if test="$axf.extensions != 0 and 
75                   $xsl1.1.bookmarks = 0 and 
76                   $show.bookmarks != 0">
77       <xsl:attribute name="axf:outline-level">
78         <xsl:value-of select="count($node/ancestor::*)"/>
79       </xsl:attribute>
80       <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
81       <xsl:attribute name="axf:outline-title">
82         <xsl:value-of select="normalize-space($title)"/>
83       </xsl:attribute>
84     </xsl:if>
85
86     <!-- Let's handle the case where a component (bibliography, for example)
87          occurs inside a section; will we need parameters for this?
88          Danger Will Robinson: using section.title.level*.properties here
89          runs the risk that someone will set something other than
90          font-size there... -->
91     <xsl:choose>
92       <xsl:when test="$level=2">
93         <fo:block xsl:use-attribute-sets="section.title.level2.properties">
94           <xsl:copy-of select="$title"/>
95         </fo:block>
96       </xsl:when>
97       <xsl:when test="$level=3">
98         <fo:block xsl:use-attribute-sets="section.title.level3.properties">
99           <xsl:copy-of select="$title"/>
100         </fo:block>
101       </xsl:when>
102       <xsl:when test="$level=4">
103         <fo:block xsl:use-attribute-sets="section.title.level4.properties">
104           <xsl:copy-of select="$title"/>
105         </fo:block>
106       </xsl:when>
107       <xsl:when test="$level=5">
108         <fo:block xsl:use-attribute-sets="section.title.level5.properties">
109           <xsl:copy-of select="$title"/>
110         </fo:block>
111       </xsl:when>
112       <xsl:when test="$level=6">
113         <fo:block xsl:use-attribute-sets="section.title.level6.properties">
114           <xsl:copy-of select="$title"/>
115         </fo:block>
116       </xsl:when>
117       <xsl:otherwise>
118         <!-- not in a section: do nothing special -->
119         <xsl:copy-of select="$title"/>
120       </xsl:otherwise>
121     </xsl:choose>
122   </fo:block>
123 </xsl:template>
124
125 <!-- ==================================================================== -->
126
127 <xsl:template match="d:dedication" mode="dedication">
128   <xsl:variable name="id">
129     <xsl:call-template name="object.id"/>
130   </xsl:variable>
131
132   <xsl:variable name="master-reference">
133     <xsl:call-template name="select.pagemaster"/>
134   </xsl:variable>
135
136   <fo:page-sequence hyphenate="{$hyphenate}"
137                     master-reference="{$master-reference}">
138     <xsl:attribute name="language">
139       <xsl:call-template name="l10n.language"/>
140     </xsl:attribute>
141     <xsl:attribute name="format">
142       <xsl:call-template name="page.number.format">
143         <xsl:with-param name="master-reference" select="$master-reference"/>
144       </xsl:call-template>
145     </xsl:attribute>
146
147     <xsl:attribute name="initial-page-number">
148       <xsl:call-template name="initial.page.number">
149         <xsl:with-param name="master-reference" select="$master-reference"/>
150       </xsl:call-template>
151     </xsl:attribute>
152
153     <xsl:attribute name="force-page-count">
154       <xsl:call-template name="force.page.count">
155         <xsl:with-param name="master-reference" select="$master-reference"/>
156       </xsl:call-template>
157     </xsl:attribute>
158
159     <xsl:attribute name="hyphenation-character">
160       <xsl:call-template name="gentext">
161         <xsl:with-param name="key" select="'hyphenation-character'"/>
162       </xsl:call-template>
163     </xsl:attribute>
164     <xsl:attribute name="hyphenation-push-character-count">
165       <xsl:call-template name="gentext">
166         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
167       </xsl:call-template>
168     </xsl:attribute>
169     <xsl:attribute name="hyphenation-remain-character-count">
170       <xsl:call-template name="gentext">
171         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
172       </xsl:call-template>
173     </xsl:attribute>
174
175     <xsl:apply-templates select="." mode="running.head.mode">
176       <xsl:with-param name="master-reference" select="$master-reference"/>
177     </xsl:apply-templates>
178
179     <xsl:apply-templates select="." mode="running.foot.mode">
180       <xsl:with-param name="master-reference" select="$master-reference"/>
181     </xsl:apply-templates>
182
183     <fo:flow flow-name="xsl-region-body">
184       <xsl:call-template name="set.flow.properties">
185         <xsl:with-param name="element" select="local-name(.)"/>
186         <xsl:with-param name="master-reference" select="$master-reference"/>
187       </xsl:call-template>
188
189       <fo:block id="{$id}"
190                 xsl:use-attribute-sets="component.titlepage.properties">
191         <xsl:call-template name="dedication.titlepage"/>
192       </fo:block>
193       <xsl:apply-templates/>
194     </fo:flow>
195   </fo:page-sequence>
196 </xsl:template>
197
198 <xsl:template match="d:dedication"></xsl:template> <!-- see mode="dedication" -->
199 <xsl:template match="d:dedication/d:docinfo"></xsl:template>
200 <xsl:template match="d:dedication/d:title"></xsl:template>
201 <xsl:template match="d:dedication/d:subtitle"></xsl:template>
202 <xsl:template match="d:dedication/d:titleabbrev"></xsl:template>
203
204 <!-- ==================================================================== -->
205
206 <xsl:template match="d:acknowledgements" mode="acknowledgements">
207   <xsl:variable name="id">
208     <xsl:call-template name="object.id"/>
209   </xsl:variable>
210
211   <xsl:variable name="master-reference">
212     <xsl:call-template name="select.pagemaster"/>
213   </xsl:variable>
214
215   <fo:page-sequence hyphenate="{$hyphenate}"
216                     master-reference="{$master-reference}">
217     <xsl:attribute name="language">
218       <xsl:call-template name="l10n.language"/>
219     </xsl:attribute>
220     <xsl:attribute name="format">
221       <xsl:call-template name="page.number.format">
222         <xsl:with-param name="master-reference" select="$master-reference"/>
223       </xsl:call-template>
224     </xsl:attribute>
225     <xsl:attribute name="initial-page-number">
226       <xsl:call-template name="initial.page.number">
227         <xsl:with-param name="master-reference" select="$master-reference"/>
228       </xsl:call-template>
229     </xsl:attribute>
230     <xsl:attribute name="force-page-count">
231       <xsl:call-template name="force.page.count">
232         <xsl:with-param name="master-reference" select="$master-reference"/>
233       </xsl:call-template>
234     </xsl:attribute>
235     <xsl:attribute name="hyphenation-character">
236       <xsl:call-template name="gentext">
237         <xsl:with-param name="key" select="'hyphenation-character'"/>
238       </xsl:call-template>
239     </xsl:attribute>
240     <xsl:attribute name="hyphenation-push-character-count">
241       <xsl:call-template name="gentext">
242         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
243       </xsl:call-template>
244     </xsl:attribute>
245     <xsl:attribute name="hyphenation-remain-character-count">
246       <xsl:call-template name="gentext">
247         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
248       </xsl:call-template>
249     </xsl:attribute>
250
251     <xsl:apply-templates select="." mode="running.head.mode">
252       <xsl:with-param name="master-reference" select="$master-reference"/>
253     </xsl:apply-templates>
254
255     <xsl:apply-templates select="." mode="running.foot.mode">
256       <xsl:with-param name="master-reference" select="$master-reference"/>
257     </xsl:apply-templates>
258
259     <fo:flow flow-name="xsl-region-body">
260       <xsl:call-template name="set.flow.properties">
261         <xsl:with-param name="element" select="local-name(.)"/>
262         <xsl:with-param name="master-reference" select="$master-reference"/>
263       </xsl:call-template>
264
265       <fo:block id="{$id}"
266                 xsl:use-attribute-sets="component.titlepage.properties">
267         <xsl:call-template name="acknowledgements.titlepage"/>
268       </fo:block>
269       <xsl:apply-templates/>
270     </fo:flow>
271   </fo:page-sequence>
272 </xsl:template>
273
274 <xsl:template match="d:acknowledgements"></xsl:template>
275 <xsl:template match="d:acknowledgements/d:info"></xsl:template>
276 <xsl:template match="d:acknowledgements/d:title"></xsl:template>
277 <xsl:template match="d:acknowledgements/d:titleabbrev"></xsl:template>
278 <xsl:template match="d:acknowledgements/d:subtitle"></xsl:template>
279
280 <!-- ==================================================================== -->
281
282 <xsl:template match="d:colophon">
283   <xsl:variable name="id">
284     <xsl:call-template name="object.id"/>
285   </xsl:variable>
286
287   <xsl:variable name="master-reference">
288     <xsl:call-template name="select.pagemaster"/>
289   </xsl:variable>
290
291   <fo:page-sequence hyphenate="{$hyphenate}"
292                     master-reference="{$master-reference}">
293     <xsl:attribute name="language">
294       <xsl:call-template name="l10n.language"/>
295     </xsl:attribute>
296     <xsl:attribute name="format">
297       <xsl:call-template name="page.number.format">
298         <xsl:with-param name="master-reference" select="$master-reference"/>
299       </xsl:call-template>
300     </xsl:attribute>
301     <xsl:attribute name="initial-page-number">
302       <xsl:call-template name="initial.page.number">
303         <xsl:with-param name="master-reference" select="$master-reference"/>
304       </xsl:call-template>
305     </xsl:attribute>
306     <xsl:attribute name="force-page-count">
307       <xsl:call-template name="force.page.count">
308         <xsl:with-param name="master-reference" select="$master-reference"/>
309       </xsl:call-template>
310     </xsl:attribute>
311     <xsl:attribute name="hyphenation-character">
312       <xsl:call-template name="gentext">
313         <xsl:with-param name="key" select="'hyphenation-character'"/>
314       </xsl:call-template>
315     </xsl:attribute>
316     <xsl:attribute name="hyphenation-push-character-count">
317       <xsl:call-template name="gentext">
318         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
319       </xsl:call-template>
320     </xsl:attribute>
321     <xsl:attribute name="hyphenation-remain-character-count">
322       <xsl:call-template name="gentext">
323         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
324       </xsl:call-template>
325     </xsl:attribute>
326
327     <xsl:apply-templates select="." mode="running.head.mode">
328       <xsl:with-param name="master-reference" select="$master-reference"/>
329     </xsl:apply-templates>
330
331     <xsl:apply-templates select="." mode="running.foot.mode">
332       <xsl:with-param name="master-reference" select="$master-reference"/>
333     </xsl:apply-templates>
334
335     <fo:flow flow-name="xsl-region-body">
336       <xsl:call-template name="set.flow.properties">
337         <xsl:with-param name="element" select="local-name(.)"/>
338         <xsl:with-param name="master-reference" select="$master-reference"/>
339       </xsl:call-template>
340
341       <fo:block id="{$id}"
342                 xsl:use-attribute-sets="component.titlepage.properties">
343         <xsl:call-template name="colophon.titlepage"/>
344       </fo:block>
345       <xsl:apply-templates/>
346     </fo:flow>
347   </fo:page-sequence>
348 </xsl:template>
349
350 <xsl:template match="d:colophon/d:title"></xsl:template>
351 <xsl:template match="d:colophon/d:subtitle"></xsl:template>
352 <xsl:template match="d:colophon/d:titleabbrev"></xsl:template>
353
354 <!-- article/colophon has no page sequence -->
355 <xsl:template match="d:article/d:colophon">
356   <xsl:variable name="id">
357     <xsl:call-template name="object.id"/>
358   </xsl:variable>
359
360   <fo:block id="{$id}">
361     <fo:block xsl:use-attribute-sets="component.titlepage.properties">
362       <xsl:call-template name="colophon.titlepage"/>
363     </fo:block>
364     <xsl:apply-templates/>
365   </fo:block>
366 </xsl:template>
367
368 <!-- ==================================================================== -->
369
370 <xsl:template match="d:preface">
371   <xsl:variable name="id">
372     <xsl:call-template name="object.id"/>
373   </xsl:variable>
374
375   <xsl:variable name="master-reference">
376     <xsl:call-template name="select.pagemaster"/>
377   </xsl:variable>
378
379   <fo:page-sequence hyphenate="{$hyphenate}"
380                     master-reference="{$master-reference}">
381     <xsl:attribute name="language">
382       <xsl:call-template name="l10n.language"/>
383     </xsl:attribute>
384     <xsl:attribute name="format">
385       <xsl:call-template name="page.number.format">
386         <xsl:with-param name="master-reference" select="$master-reference"/>
387       </xsl:call-template>
388     </xsl:attribute>
389
390     <xsl:attribute name="initial-page-number">
391       <xsl:call-template name="initial.page.number">
392         <xsl:with-param name="master-reference" select="$master-reference"/>
393       </xsl:call-template>
394     </xsl:attribute>
395
396     <xsl:attribute name="force-page-count">
397       <xsl:call-template name="force.page.count">
398         <xsl:with-param name="master-reference" select="$master-reference"/>
399       </xsl:call-template>
400     </xsl:attribute>
401
402     <xsl:attribute name="hyphenation-character">
403       <xsl:call-template name="gentext">
404         <xsl:with-param name="key" select="'hyphenation-character'"/>
405       </xsl:call-template>
406     </xsl:attribute>
407     <xsl:attribute name="hyphenation-push-character-count">
408       <xsl:call-template name="gentext">
409         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
410       </xsl:call-template>
411     </xsl:attribute>
412     <xsl:attribute name="hyphenation-remain-character-count">
413       <xsl:call-template name="gentext">
414         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
415       </xsl:call-template>
416     </xsl:attribute>
417
418     <xsl:apply-templates select="." mode="running.head.mode">
419       <xsl:with-param name="master-reference" select="$master-reference"/>
420     </xsl:apply-templates>
421
422     <xsl:apply-templates select="." mode="running.foot.mode">
423       <xsl:with-param name="master-reference" select="$master-reference"/>
424     </xsl:apply-templates>
425
426     <fo:flow flow-name="xsl-region-body">
427       <xsl:call-template name="set.flow.properties">
428         <xsl:with-param name="element" select="local-name(.)"/>
429         <xsl:with-param name="master-reference" select="$master-reference"/>
430       </xsl:call-template>
431
432       <fo:block id="{$id}"
433                 xsl:use-attribute-sets="component.titlepage.properties">
434         <xsl:call-template name="preface.titlepage"/>
435       </fo:block>
436
437       <xsl:call-template name="make.component.tocs"/>
438
439       <xsl:apply-templates/>
440     </fo:flow>
441   </fo:page-sequence>
442 </xsl:template>
443
444 <xsl:template match="d:preface/d:docinfo|d:prefaceinfo"></xsl:template>
445 <xsl:template match="d:preface/d:info"></xsl:template>
446 <xsl:template match="d:preface/d:title"></xsl:template>
447 <xsl:template match="d:preface/d:titleabbrev"></xsl:template>
448 <xsl:template match="d:preface/d:subtitle"></xsl:template>
449
450 <!-- ==================================================================== -->
451
452 <xsl:template match="d:chapter">
453   <xsl:variable name="id">
454     <xsl:call-template name="object.id"/>
455   </xsl:variable>
456
457   <xsl:variable name="master-reference">
458     <xsl:call-template name="select.pagemaster"/>
459   </xsl:variable>
460
461   <fo:page-sequence hyphenate="{$hyphenate}"
462                     master-reference="{$master-reference}">
463     <xsl:attribute name="language">
464       <xsl:call-template name="l10n.language"/>
465     </xsl:attribute>
466     <xsl:attribute name="format">
467       <xsl:call-template name="page.number.format">
468         <xsl:with-param name="master-reference" select="$master-reference"/>
469       </xsl:call-template>
470     </xsl:attribute>
471     <xsl:attribute name="initial-page-number">
472       <xsl:call-template name="initial.page.number">
473         <xsl:with-param name="master-reference" select="$master-reference"/>
474       </xsl:call-template>
475     </xsl:attribute>
476
477     <xsl:attribute name="force-page-count">
478       <xsl:call-template name="force.page.count">
479         <xsl:with-param name="master-reference" select="$master-reference"/>
480       </xsl:call-template>
481     </xsl:attribute>
482
483     <xsl:attribute name="hyphenation-character">
484       <xsl:call-template name="gentext">
485         <xsl:with-param name="key" select="'hyphenation-character'"/>
486       </xsl:call-template>
487     </xsl:attribute>
488     <xsl:attribute name="hyphenation-push-character-count">
489       <xsl:call-template name="gentext">
490         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
491       </xsl:call-template>
492     </xsl:attribute>
493     <xsl:attribute name="hyphenation-remain-character-count">
494       <xsl:call-template name="gentext">
495         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
496       </xsl:call-template>
497     </xsl:attribute>
498
499     <xsl:apply-templates select="." mode="running.head.mode">
500       <xsl:with-param name="master-reference" select="$master-reference"/>
501     </xsl:apply-templates>
502
503     <xsl:apply-templates select="." mode="running.foot.mode">
504       <xsl:with-param name="master-reference" select="$master-reference"/>
505     </xsl:apply-templates>
506
507     <fo:flow flow-name="xsl-region-body">
508       <xsl:call-template name="set.flow.properties">
509         <xsl:with-param name="element" select="local-name(.)"/>
510         <xsl:with-param name="master-reference" select="$master-reference"/>
511       </xsl:call-template>
512
513       <fo:block id="{$id}"
514                 xsl:use-attribute-sets="component.titlepage.properties">
515         <xsl:call-template name="chapter.titlepage"/>
516       </fo:block>
517
518       <xsl:call-template name="make.component.tocs"/>
519
520       <xsl:apply-templates/>
521     </fo:flow>
522   </fo:page-sequence>
523 </xsl:template>
524
525 <xsl:template match="d:chapter/d:docinfo|d:chapterinfo"></xsl:template>
526 <xsl:template match="d:chapter/d:info"></xsl:template>
527 <xsl:template match="d:chapter/d:title"></xsl:template>
528 <xsl:template match="d:chapter/d:titleabbrev"></xsl:template>
529 <xsl:template match="d:chapter/d:subtitle"></xsl:template>
530
531 <!-- ==================================================================== -->
532
533 <xsl:template match="d:appendix">
534   <xsl:variable name="id">
535     <xsl:call-template name="object.id"/>
536   </xsl:variable>
537
538   <xsl:variable name="master-reference">
539     <xsl:call-template name="select.pagemaster"/>
540   </xsl:variable>
541
542   <fo:page-sequence hyphenate="{$hyphenate}"
543                     master-reference="{$master-reference}">
544     <xsl:attribute name="language">
545       <xsl:call-template name="l10n.language"/>
546     </xsl:attribute>
547     <xsl:attribute name="format">
548       <xsl:call-template name="page.number.format">
549         <xsl:with-param name="master-reference" select="$master-reference"/>
550       </xsl:call-template>
551     </xsl:attribute>
552     <xsl:attribute name="initial-page-number">
553       <xsl:call-template name="initial.page.number">
554         <xsl:with-param name="master-reference" select="$master-reference"/>
555       </xsl:call-template>
556     </xsl:attribute>
557
558     <xsl:attribute name="force-page-count">
559       <xsl:call-template name="force.page.count">
560         <xsl:with-param name="master-reference" select="$master-reference"/>
561       </xsl:call-template>
562     </xsl:attribute>
563
564     <xsl:attribute name="hyphenation-character">
565       <xsl:call-template name="gentext">
566         <xsl:with-param name="key" select="'hyphenation-character'"/>
567       </xsl:call-template>
568     </xsl:attribute>
569     <xsl:attribute name="hyphenation-push-character-count">
570       <xsl:call-template name="gentext">
571         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
572       </xsl:call-template>
573     </xsl:attribute>
574     <xsl:attribute name="hyphenation-remain-character-count">
575       <xsl:call-template name="gentext">
576         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
577       </xsl:call-template>
578     </xsl:attribute>
579
580     <xsl:apply-templates select="." mode="running.head.mode">
581       <xsl:with-param name="master-reference" select="$master-reference"/>
582     </xsl:apply-templates>
583
584     <xsl:apply-templates select="." mode="running.foot.mode">
585       <xsl:with-param name="master-reference" select="$master-reference"/>
586     </xsl:apply-templates>
587
588     <fo:flow flow-name="xsl-region-body">
589       <xsl:call-template name="set.flow.properties">
590         <xsl:with-param name="element" select="local-name(.)"/>
591         <xsl:with-param name="master-reference" select="$master-reference"/>
592       </xsl:call-template>
593
594       <fo:block id="{$id}"
595                 xsl:use-attribute-sets="component.titlepage.properties">
596         <xsl:call-template name="appendix.titlepage"/>
597       </fo:block>
598
599       <xsl:call-template name="make.component.tocs"/>
600
601       <xsl:apply-templates/>
602     </fo:flow>
603   </fo:page-sequence>
604 </xsl:template>
605
606 <xsl:template match="d:appendix/d:docinfo|d:appendixinfo"></xsl:template>
607 <xsl:template match="d:appendix/d:info"></xsl:template>
608 <xsl:template match="d:appendix/d:title"></xsl:template>
609 <xsl:template match="d:appendix/d:titleabbrev"></xsl:template>
610 <xsl:template match="d:appendix/d:subtitle"></xsl:template>
611
612 <!-- ==================================================================== -->
613
614 <xsl:template match="d:article">
615   <xsl:variable name="id">
616     <xsl:call-template name="object.id"/>
617   </xsl:variable>
618
619   <xsl:variable name="master-reference">
620     <xsl:call-template name="select.pagemaster"/>
621   </xsl:variable>
622
623   <fo:page-sequence hyphenate="{$hyphenate}"
624                     master-reference="{$master-reference}">
625     <xsl:attribute name="language">
626       <xsl:call-template name="l10n.language"/>
627     </xsl:attribute>
628     <xsl:attribute name="format">
629       <xsl:call-template name="page.number.format">
630         <xsl:with-param name="master-reference" select="$master-reference"/>
631       </xsl:call-template>
632     </xsl:attribute>
633     <xsl:attribute name="initial-page-number">
634       <xsl:call-template name="initial.page.number">
635         <xsl:with-param name="master-reference" select="$master-reference"/>
636       </xsl:call-template>
637     </xsl:attribute>
638
639     <xsl:attribute name="force-page-count">
640       <xsl:call-template name="force.page.count">
641         <xsl:with-param name="master-reference" select="$master-reference"/>
642       </xsl:call-template>
643     </xsl:attribute>
644
645     <xsl:attribute name="hyphenation-character">
646       <xsl:call-template name="gentext">
647         <xsl:with-param name="key" select="'hyphenation-character'"/>
648       </xsl:call-template>
649     </xsl:attribute>
650     <xsl:attribute name="hyphenation-push-character-count">
651       <xsl:call-template name="gentext">
652         <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
653       </xsl:call-template>
654     </xsl:attribute>
655     <xsl:attribute name="hyphenation-remain-character-count">
656       <xsl:call-template name="gentext">
657         <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
658       </xsl:call-template>
659     </xsl:attribute>
660
661     <xsl:apply-templates select="." mode="running.head.mode">
662       <xsl:with-param name="master-reference" select="$master-reference"/>
663     </xsl:apply-templates>
664
665     <xsl:apply-templates select="." mode="running.foot.mode">
666       <xsl:with-param name="master-reference" select="$master-reference"/>
667     </xsl:apply-templates>
668
669     <fo:flow flow-name="xsl-region-body">
670       <xsl:call-template name="set.flow.properties">
671         <xsl:with-param name="element" select="local-name(.)"/>
672         <xsl:with-param name="master-reference" select="$master-reference"/>
673       </xsl:call-template>
674
675       <fo:block id="{$id}"
676                 xsl:use-attribute-sets="component.titlepage.properties">
677         <xsl:call-template name="article.titlepage"/>
678       </fo:block>
679
680       <xsl:call-template name="make.component.tocs"/>
681
682       <xsl:apply-templates/>
683     </fo:flow>
684   </fo:page-sequence>
685 </xsl:template>
686
687 <xsl:template match="d:article/d:artheader"></xsl:template>
688 <xsl:template match="d:article/d:articleinfo"></xsl:template>
689 <xsl:template match="d:article/d:info"></xsl:template>
690 <xsl:template match="d:article/d:title"></xsl:template>
691 <xsl:template match="d:article/d:subtitle"></xsl:template>
692 <xsl:template match="d:article/d:titleabbrev"></xsl:template>
693
694 <xsl:template match="d:article/d:appendix">
695   <xsl:variable name="id">
696     <xsl:call-template name="object.id"/>
697   </xsl:variable>
698
699   <xsl:variable name="title">
700     <xsl:apply-templates select="." mode="object.title.markup"/>
701   </xsl:variable>
702
703   <xsl:variable name="titleabbrev">
704     <xsl:apply-templates select="." mode="titleabbrev.markup"/>
705   </xsl:variable>
706
707   <fo:block id='{$id}'>
708     <xsl:if test="$axf.extensions != 0 and 
709                   $xsl1.1.bookmarks = 0 and 
710                   $show.bookmarks != 0">
711       <xsl:attribute name="axf:outline-level">
712         <xsl:value-of select="count(ancestor::*)+2"/>
713       </xsl:attribute>
714       <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
715       <xsl:attribute name="axf:outline-title">
716         <xsl:value-of select="normalize-space($titleabbrev)"/>
717       </xsl:attribute>
718     </xsl:if>
719
720     <fo:block xsl:use-attribute-sets="article.appendix.title.properties">
721       <fo:marker marker-class-name="section.head.marker">
722         <xsl:choose>
723           <xsl:when test="$titleabbrev = ''">
724             <xsl:value-of select="$title"/>
725           </xsl:when>
726           <xsl:otherwise>
727             <xsl:value-of select="$titleabbrev"/>
728           </xsl:otherwise>
729         </xsl:choose>
730       </fo:marker>
731       <xsl:copy-of select="$title"/>
732     </fo:block>
733
734     <xsl:call-template name="make.component.tocs"/>
735
736     <xsl:apply-templates/>
737   </fo:block>
738 </xsl:template>
739
740 <!-- ==================================================================== -->
741
742 <!-- Utility template to create a page sequence for an element -->
743 <xsl:template match="*" mode="page.sequence" name="page.sequence">
744   <xsl:param name="content">
745     <xsl:apply-templates/>
746   </xsl:param>
747   <xsl:param name="master-reference">
748     <xsl:call-template name="select.pagemaster"/>
749   </xsl:param>
750   <xsl:param name="element" select="local-name(.)"/>
751   <xsl:param name="gentext-key" select="local-name(.)"/>
752   <xsl:param name="language">
753     <xsl:call-template name="l10n.language"/>
754   </xsl:param>
755
756   <xsl:param name="format">
757     <xsl:call-template name="page.number.format">
758       <xsl:with-param name="master-reference" select="$master-reference"/>
759       <xsl:with-param name="element" select="$element"/>
760     </xsl:call-template>
761   </xsl:param>
762
763   <xsl:param name="initial-page-number">
764     <xsl:call-template name="initial.page.number">
765       <xsl:with-param name="master-reference" select="$master-reference"/>
766       <xsl:with-param name="element" select="$element"/>
767     </xsl:call-template>
768   </xsl:param>
769
770   <xsl:param name="force-page-count">
771     <xsl:call-template name="force.page.count">
772       <xsl:with-param name="master-reference" select="$master-reference"/>
773       <xsl:with-param name="element" select="$element"/>
774     </xsl:call-template>
775   </xsl:param>
776
777   <xsl:choose>
778     <xsl:when test="string-length($content) != 0">
779       <fo:page-sequence hyphenate="{$hyphenate}"
780                         master-reference="{$master-reference}">
781         <xsl:attribute name="language">
782           <xsl:value-of select="$language"/>
783         </xsl:attribute>
784         <xsl:attribute name="format">
785           <xsl:value-of select="$format"/>
786         </xsl:attribute>
787     
788         <xsl:attribute name="initial-page-number">
789           <xsl:value-of select="$initial-page-number"/>
790         </xsl:attribute>
791     
792         <xsl:attribute name="force-page-count">
793           <xsl:value-of select="$force-page-count"/>
794         </xsl:attribute>
795     
796         <xsl:attribute name="hyphenation-character">
797           <xsl:call-template name="gentext">
798             <xsl:with-param name="key" select="'hyphenation-character'"/>
799           </xsl:call-template>
800         </xsl:attribute>
801         <xsl:attribute name="hyphenation-push-character-count">
802           <xsl:call-template name="gentext">
803             <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
804           </xsl:call-template>
805         </xsl:attribute>
806         <xsl:attribute name="hyphenation-remain-character-count">
807           <xsl:call-template name="gentext">
808             <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
809           </xsl:call-template>
810         </xsl:attribute>
811     
812         <xsl:apply-templates select="." mode="running.head.mode">
813           <xsl:with-param name="master-reference" select="$master-reference"/>
814           <xsl:with-param name="gentext-key" select="$gentext-key"/>
815         </xsl:apply-templates>
816     
817         <xsl:apply-templates select="." mode="running.foot.mode">
818           <xsl:with-param name="master-reference" select="$master-reference"/>
819           <xsl:with-param name="gentext-key" select="$gentext-key"/>
820         </xsl:apply-templates>
821     
822         <fo:flow flow-name="xsl-region-body">
823           <xsl:call-template name="set.flow.properties">
824             <xsl:with-param name="element" select="local-name(.)"/>
825             <xsl:with-param name="master-reference" select="$master-reference"/>
826           </xsl:call-template>
827     
828           <xsl:copy-of select="$content"/>
829     
830         </fo:flow>
831       </fo:page-sequence>
832     </xsl:when>
833     <xsl:otherwise>
834       <xsl:message>
835         <xsl:text>WARNING: call to template 'page.sequence' </xsl:text>
836         <xsl:text>has zero length content; no page-sequence generated.</xsl:text>
837       </xsl:message>
838     </xsl:otherwise>
839   </xsl:choose>
840 </xsl:template>
841
842 <xsl:template name="make.component.tocs">
843
844   <xsl:variable name="toc.params">
845     <xsl:call-template name="find.path.params">
846       <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
847     </xsl:call-template>
848   </xsl:variable>
849
850   <xsl:if test="contains($toc.params, 'toc')">
851     <xsl:call-template name="component.toc">
852       <xsl:with-param name="toc.title.p" 
853                       select="contains($toc.params, 'title')"/>
854     </xsl:call-template>
855   </xsl:if>
856
857   <xsl:if test="contains($toc.params,'figure') and .//d:figure">
858     <xsl:call-template name="component.list.of.titles">
859       <xsl:with-param name="titles" select="'figure'"/>
860       <xsl:with-param name="nodes" select=".//d:figure"/>
861     </xsl:call-template>
862   </xsl:if>
863
864   <xsl:if test="contains($toc.params,'table') and .//d:table">
865     <xsl:call-template name="component.list.of.titles">
866       <xsl:with-param name="titles" select="'table'"/>
867       <xsl:with-param name="nodes" select=".//d:table[not(@tocentry = 0)]"/>
868     </xsl:call-template>
869   </xsl:if>
870
871   <xsl:if test="contains($toc.params,'example') and .//d:example">
872     <xsl:call-template name="component.list.of.titles">
873       <xsl:with-param name="titles" select="'example'"/>
874       <xsl:with-param name="nodes" select=".//d:example"/>
875     </xsl:call-template>
876   </xsl:if>
877
878   <xsl:if test="contains($toc.params,'equation') and 
879                  .//d:equation[d:title or d:info/d:title]">
880     <xsl:call-template name="component.list.of.titles">
881       <xsl:with-param name="titles" select="'equation'"/>
882       <xsl:with-param name="nodes" 
883                       select=".//d:equation[d:title or d:info/d:title]"/>
884     </xsl:call-template>
885   </xsl:if>
886
887   <xsl:if test="contains($toc.params,'procedure') and 
888                  .//d:procedure[d:title or d:info/d:title]">
889     <xsl:call-template name="component.list.of.titles">
890       <xsl:with-param name="titles" select="'procedure'"/>
891       <xsl:with-param name="nodes" 
892                       select=".//d:procedure[d:title or d:info/d:title]"/>
893     </xsl:call-template>
894   </xsl:if>
895
896   <xsl:choose>
897     <xsl:when test="$toc.params = ''">
898     </xsl:when>
899     <xsl:when test="$toc.params = 'nop'">
900     </xsl:when>
901     <xsl:otherwise>
902       <xsl:call-template name="component.toc.separator"/>
903     </xsl:otherwise>
904   </xsl:choose>
905
906 </xsl:template>
907
908 <xsl:template match="d:topic">
909   <xsl:variable name="id">
910     <xsl:call-template name="object.id"/>
911   </xsl:variable>
912
913   <xsl:element name="fo:{$section.container.element}">
914     <xsl:attribute name="id"><xsl:value-of 
915                         select="$id"/></xsl:attribute>
916     <xsl:call-template name="topic.titlepage"/>
917
918     <xsl:apply-templates/>
919
920   </xsl:element>
921 </xsl:template>
922
923 <xsl:template match="/d:topic | d:book/d:topic" name="topic.page.sequence">
924   <xsl:variable name="master-reference">
925     <xsl:call-template name="select.pagemaster"/>
926   </xsl:variable>
927   <xsl:variable name="id">
928     <xsl:call-template name="object.id"/>
929   </xsl:variable>
930
931   <xsl:apply-templates select="." mode="page.sequence">
932     <xsl:with-param name="master-reference" select="$master-reference"/>
933     <xsl:with-param name="content">
934       <xsl:element name="fo:{$section.container.element}">
935         <xsl:attribute name="id"><xsl:value-of 
936                             select="$id"/></xsl:attribute>
937         <xsl:call-template name="topic.titlepage"/>
938     
939         <xsl:apply-templates/>
940
941       </xsl:element>
942     </xsl:with-param>
943   </xsl:apply-templates>
944 </xsl:template>
945
946 <xsl:template match="d:topic/d:info"></xsl:template>
947 <xsl:template match="d:topic/d:title"></xsl:template>
948 <xsl:template match="d:topic/d:subtitle"></xsl:template>
949 <xsl:template match="d:topic/d:titleabbrev"></xsl:template>
950
951 </xsl:stylesheet>
952