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