source: clfs-sysroot/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/fo/sections.xsl @ a18aefd

Last change on this file since a18aefd was a18aefd, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 27.6 KB
Line 
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$
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<xsl:template match="section">
20  <xsl:choose>
21    <xsl:when test="$rootid = @id or $rootid = @xml:id">
22      <xsl:call-template name="section.page.sequence"/>
23    </xsl:when>
24    <xsl:otherwise>
25      <xsl:variable name="id">
26        <xsl:call-template name="object.id"/>
27      </xsl:variable>
28
29      <xsl:variable name="renderas">
30        <xsl:choose>
31          <xsl:when test="@renderas = 'sect1'">1</xsl:when>
32          <xsl:when test="@renderas = 'sect2'">2</xsl:when>
33          <xsl:when test="@renderas = 'sect3'">3</xsl:when>
34          <xsl:when test="@renderas = 'sect4'">4</xsl:when>
35          <xsl:when test="@renderas = 'sect5'">5</xsl:when>
36          <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
37        </xsl:choose>
38      </xsl:variable>
39
40      <xsl:variable name="level">
41        <xsl:choose>
42          <xsl:when test="$renderas != ''">
43            <xsl:value-of select="$renderas"/>
44          </xsl:when>
45          <xsl:otherwise>
46            <xsl:call-template name="section.level"/>
47          </xsl:otherwise>
48        </xsl:choose>
49      </xsl:variable>
50
51      <!-- xsl:use-attribute-sets takes only a Qname, not a variable -->
52      <xsl:choose>
53        <xsl:when test="$level = 1">
54          <xsl:element name="fo:{$section.container.element}"
55                       use-attribute-sets="section.level1.properties">
56            <xsl:attribute name="id"><xsl:value-of 
57                                select="$id"/></xsl:attribute>
58            <xsl:call-template name="section.content"/>
59          </xsl:element>
60        </xsl:when>
61        <xsl:when test="$level = 2">
62          <xsl:element name="fo:{$section.container.element}"
63                       use-attribute-sets="section.level2.properties">
64            <xsl:attribute name="id"><xsl:value-of 
65                                select="$id"/></xsl:attribute>
66            <xsl:call-template name="section.content"/>
67          </xsl:element>
68        </xsl:when>
69        <xsl:when test="$level = 3">
70          <xsl:element name="fo:{$section.container.element}"
71                       use-attribute-sets="section.level3.properties">
72            <xsl:attribute name="id"><xsl:value-of 
73                                select="$id"/></xsl:attribute>
74            <xsl:call-template name="section.content"/>
75          </xsl:element>
76        </xsl:when>
77        <xsl:when test="$level = 4">
78          <xsl:element name="fo:{$section.container.element}"
79                       use-attribute-sets="section.level4.properties">
80            <xsl:attribute name="id"><xsl:value-of 
81                                select="$id"/></xsl:attribute>
82            <xsl:call-template name="section.content"/>
83          </xsl:element>
84        </xsl:when>
85        <xsl:when test="$level = 5">
86          <xsl:element name="fo:{$section.container.element}"
87                       use-attribute-sets="section.level5.properties">
88            <xsl:attribute name="id"><xsl:value-of 
89                                select="$id"/></xsl:attribute>
90            <xsl:call-template name="section.content"/>
91          </xsl:element>
92        </xsl:when>
93        <xsl:otherwise>
94          <xsl:element name="fo:{$section.container.element}"
95                       use-attribute-sets="section.level6.properties">
96            <xsl:attribute name="id"><xsl:value-of 
97                                select="$id"/></xsl:attribute>
98            <xsl:call-template name="section.content"/>
99          </xsl:element>
100        </xsl:otherwise>
101      </xsl:choose>
102    </xsl:otherwise>
103  </xsl:choose>
104</xsl:template>
105
106<xsl:template name="section.content">
107  <xsl:call-template name="section.titlepage"/>
108
109  <xsl:variable name="toc.params">
110    <xsl:call-template name="find.path.params">
111      <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
112    </xsl:call-template>
113  </xsl:variable>
114
115  <xsl:if test="contains($toc.params, 'toc')
116                and (count(ancestor::section)+1) &lt;=
117                $generate.section.toc.level">
118    <xsl:call-template name="section.toc">
119      <xsl:with-param name="toc.title.p" 
120                      select="contains($toc.params, 'title')"/>
121    </xsl:call-template>
122   <xsl:call-template name="section.toc.separator"/>
123  </xsl:if>
124
125  <xsl:apply-templates/>
126</xsl:template>
127
128<xsl:template match="/section" name="section.page.sequence">
129  <xsl:variable name="id">
130    <xsl:call-template name="object.id"/>
131  </xsl:variable>
132
133  <xsl:variable name="master-reference">
134    <xsl:call-template name="select.pagemaster"/>
135  </xsl:variable>
136
137  <fo:page-sequence hyphenate="{$hyphenate}"
138                    master-reference="{$master-reference}">
139    <xsl:attribute name="language">
140      <xsl:call-template name="l10n.language"/>
141    </xsl:attribute>
142    <xsl:attribute name="format">
143      <xsl:call-template name="page.number.format">
144        <xsl:with-param name="master-reference" select="$master-reference"/>
145      </xsl:call-template>
146    </xsl:attribute>
147
148    <xsl:attribute name="initial-page-number">
149      <xsl:call-template name="initial.page.number">
150        <xsl:with-param name="master-reference" select="$master-reference"/>
151      </xsl:call-template>
152    </xsl:attribute>
153
154    <xsl:attribute name="force-page-count">
155      <xsl:call-template name="force.page.count">
156        <xsl:with-param name="master-reference" select="$master-reference"/>
157      </xsl:call-template>
158    </xsl:attribute>
159
160    <xsl:attribute name="hyphenation-character">
161      <xsl:call-template name="gentext">
162        <xsl:with-param name="key" select="'hyphenation-character'"/>
163      </xsl:call-template>
164    </xsl:attribute>
165    <xsl:attribute name="hyphenation-push-character-count">
166      <xsl:call-template name="gentext">
167        <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
168      </xsl:call-template>
169    </xsl:attribute>
170    <xsl:attribute name="hyphenation-remain-character-count">
171      <xsl:call-template name="gentext">
172        <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
173      </xsl:call-template>
174    </xsl:attribute>
175
176    <xsl:apply-templates select="." mode="running.head.mode">
177      <xsl:with-param name="master-reference" select="$master-reference"/>
178    </xsl:apply-templates>
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="section.level1.properties">
191        <xsl:call-template name="section.titlepage"/>
192      </fo:block>
193
194      <xsl:variable name="toc.params">
195        <xsl:call-template name="find.path.params">
196          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
197        </xsl:call-template>
198      </xsl:variable>
199
200      <xsl:if test="contains($toc.params, 'toc')
201                    and (count(ancestor::section)+1) &lt;=
202                    $generate.section.toc.level">
203        <xsl:call-template name="section.toc">
204          <xsl:with-param name="toc.title.p" 
205                          select="contains($toc.params, 'title')"/>
206        </xsl:call-template>
207        <xsl:call-template name="section.toc.separator"/>
208      </xsl:if>
209
210      <xsl:apply-templates/>
211   </fo:flow>
212  </fo:page-sequence>
213</xsl:template>
214
215<xsl:template match="section/title
216                     |simplesect/title
217                     |sect1/title
218                     |sect2/title
219                     |sect3/title
220                     |sect4/title
221                     |sect5/title
222                     |section/info/title
223                     |simplesect/info/title
224                     |sect1/info/title
225                     |sect2/info/title
226                     |sect3/info/title
227                     |sect4/info/title
228                     |sect5/info/title
229                     |section/sectioninfo/title
230                     |sect1/sect1info/title
231                     |sect2/sect2info/title
232                     |sect3/sect3info/title
233                     |sect4/sect4info/title
234                     |sect5/sect5info/title"
235              mode="titlepage.mode"
236              priority="2">
237
238  <xsl:variable name="section" 
239                select="(ancestor::section |
240                        ancestor::simplesect |
241                        ancestor::sect1 |
242                        ancestor::sect2 |
243                        ancestor::sect3 |
244                        ancestor::sect4 |
245                        ancestor::sect5)[position() = last()]"/>
246
247  <fo:block keep-with-next.within-column="always">
248    <xsl:variable name="id">
249      <xsl:call-template name="object.id">
250        <xsl:with-param name="object" select="$section"/>
251      </xsl:call-template>
252    </xsl:variable>
253
254    <xsl:variable name="renderas">
255      <xsl:choose>
256        <xsl:when test="$section/@renderas = 'sect1'">1</xsl:when>
257        <xsl:when test="$section/@renderas = 'sect2'">2</xsl:when>
258        <xsl:when test="$section/@renderas = 'sect3'">3</xsl:when>
259        <xsl:when test="$section/@renderas = 'sect4'">4</xsl:when>
260        <xsl:when test="$section/@renderas = 'sect5'">5</xsl:when>
261        <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
262      </xsl:choose>
263    </xsl:variable>
264 
265    <xsl:variable name="level">
266      <xsl:choose>
267        <xsl:when test="$renderas != ''">
268          <xsl:value-of select="$renderas"/>
269        </xsl:when>
270        <xsl:otherwise>
271          <xsl:call-template name="section.level">
272            <xsl:with-param name="node" select="$section"/>
273          </xsl:call-template>
274        </xsl:otherwise>
275      </xsl:choose>
276    </xsl:variable>
277
278    <xsl:variable name="marker">
279      <xsl:choose>
280        <xsl:when test="$level &lt;= $marker.section.level">1</xsl:when>
281        <xsl:otherwise>0</xsl:otherwise>
282      </xsl:choose>
283    </xsl:variable>
284
285    <xsl:variable name="title">
286      <xsl:apply-templates select="$section" mode="object.title.markup">
287        <xsl:with-param name="allow-anchors" select="1"/>
288      </xsl:apply-templates>
289    </xsl:variable>
290
291    <xsl:variable name="marker.title">
292      <xsl:apply-templates select="$section" mode="titleabbrev.markup">
293        <xsl:with-param name="allow-anchors" select="0"/>
294      </xsl:apply-templates>
295    </xsl:variable>
296
297    <xsl:if test="$passivetex.extensions != 0">
298      <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex" 
299                      fotex-bookmark-level="{$level + 2}" 
300                      fotex-bookmark-label="{$id}">
301        <xsl:value-of select="$marker.title"/>
302      </fotex:bookmark>
303    </xsl:if>
304
305    <xsl:if test="$axf.extensions != 0">
306      <xsl:attribute name="axf:outline-level">
307        <xsl:value-of select="count(ancestor::*)-1"/>
308      </xsl:attribute>
309      <xsl:attribute name="axf:outline-expand">false</xsl:attribute>
310      <xsl:attribute name="axf:outline-title">
311        <xsl:value-of select="normalize-space($title)"/>
312      </xsl:attribute>
313    </xsl:if>
314
315    <xsl:call-template name="section.heading">
316      <xsl:with-param name="level" select="$level"/>
317      <xsl:with-param name="title" select="$title"/>
318      <xsl:with-param name="marker" select="$marker"/>
319      <xsl:with-param name="marker.title" select="$marker.title"/>
320    </xsl:call-template>
321  </fo:block>
322</xsl:template>
323
324<xsl:template match="sect1">
325  <xsl:variable name="id">
326    <xsl:call-template name="object.id"/>
327  </xsl:variable>
328
329  <xsl:element name="fo:{$section.container.element}"
330               use-attribute-sets="section.level1.properties">
331    <xsl:attribute name="id"><xsl:value-of 
332                        select="$id"/></xsl:attribute>
333    <xsl:call-template name="sect1.titlepage"/>
334
335    <xsl:variable name="toc.params">
336      <xsl:call-template name="find.path.params">
337        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
338      </xsl:call-template>
339    </xsl:variable>
340
341    <xsl:if test="contains($toc.params, 'toc')
342                  and $generate.section.toc.level &gt;= 1">
343      <xsl:call-template name="section.toc">
344        <xsl:with-param name="toc.title.p" 
345                        select="contains($toc.params, 'title')"/>
346      </xsl:call-template>
347      <xsl:call-template name="section.toc.separator"/>
348    </xsl:if>
349
350    <xsl:apply-templates/>
351  </xsl:element>
352</xsl:template>
353
354<xsl:template match="/sect1">
355  <xsl:variable name="id">
356    <xsl:call-template name="object.id"/>
357  </xsl:variable>
358  <xsl:variable name="master-reference">
359    <xsl:call-template name="select.pagemaster"/>
360  </xsl:variable>
361
362  <fo:page-sequence hyphenate="{$hyphenate}"
363                    master-reference="{$master-reference}">
364    <xsl:attribute name="language">
365      <xsl:call-template name="l10n.language"/>
366    </xsl:attribute>
367    <xsl:attribute name="format">
368      <xsl:call-template name="page.number.format">
369        <xsl:with-param name="master-reference" select="$master-reference"/>
370      </xsl:call-template>
371    </xsl:attribute>
372
373    <xsl:attribute name="initial-page-number">
374      <xsl:call-template name="initial.page.number">
375        <xsl:with-param name="master-reference" select="$master-reference"/>
376      </xsl:call-template>
377    </xsl:attribute>
378
379    <xsl:attribute name="force-page-count">
380      <xsl:call-template name="force.page.count">
381        <xsl:with-param name="master-reference" select="$master-reference"/>
382      </xsl:call-template>
383    </xsl:attribute>
384
385    <xsl:attribute name="hyphenation-character">
386      <xsl:call-template name="gentext">
387        <xsl:with-param name="key" select="'hyphenation-character'"/>
388      </xsl:call-template>
389    </xsl:attribute>
390    <xsl:attribute name="hyphenation-push-character-count">
391      <xsl:call-template name="gentext">
392        <xsl:with-param name="key" select="'hyphenation-push-character-count'"/>
393      </xsl:call-template>
394    </xsl:attribute>
395    <xsl:attribute name="hyphenation-remain-character-count">
396      <xsl:call-template name="gentext">
397        <xsl:with-param name="key" select="'hyphenation-remain-character-count'"/>
398      </xsl:call-template>
399    </xsl:attribute>
400
401    <xsl:apply-templates select="." mode="running.head.mode">
402      <xsl:with-param name="master-reference" select="$master-reference"/>
403    </xsl:apply-templates>
404    <xsl:apply-templates select="." mode="running.foot.mode">
405      <xsl:with-param name="master-reference" select="$master-reference"/>
406    </xsl:apply-templates>
407
408    <fo:flow flow-name="xsl-region-body">
409      <xsl:call-template name="set.flow.properties">
410        <xsl:with-param name="element" select="local-name(.)"/>
411        <xsl:with-param name="master-reference" select="$master-reference"/>
412      </xsl:call-template>
413
414      <fo:block id="{$id}" 
415                xsl:use-attribute-sets="section.level1.properties">
416        <xsl:call-template name="sect1.titlepage"/>
417      </fo:block>
418
419      <xsl:variable name="toc.params">
420        <xsl:call-template name="find.path.params">
421          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
422        </xsl:call-template>
423      </xsl:variable>
424
425      <xsl:if test="contains($toc.params, 'toc')
426                    and $generate.section.toc.level &gt;= 1">
427        <xsl:call-template name="section.toc">
428          <xsl:with-param name="toc.title.p" 
429                          select="contains($toc.params, 'title')"/>
430        </xsl:call-template>
431        <xsl:call-template name="section.toc.separator"/>
432      </xsl:if>
433
434      <xsl:apply-templates/>
435   </fo:flow>
436  </fo:page-sequence>
437</xsl:template>
438
439<xsl:template match="sect2">
440  <xsl:variable name="id">
441    <xsl:call-template name="object.id"/>
442  </xsl:variable>
443
444  <xsl:element name="fo:{$section.container.element}"
445               use-attribute-sets="section.level2.properties">
446    <xsl:attribute name="id"><xsl:value-of 
447                        select="$id"/></xsl:attribute>
448    <xsl:call-template name="sect2.titlepage"/>
449
450    <xsl:variable name="toc.params">
451      <xsl:call-template name="find.path.params">
452        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
453      </xsl:call-template>
454    </xsl:variable>
455
456    <xsl:if test="contains($toc.params, 'toc')
457                   and $generate.section.toc.level &gt;= 2">
458      <xsl:call-template name="section.toc">
459        <xsl:with-param name="toc.title.p" 
460                        select="contains($toc.params, 'title')"/>
461      </xsl:call-template>
462      <xsl:call-template name="section.toc.separator"/>
463    </xsl:if>
464
465    <xsl:apply-templates/>
466  </xsl:element>
467</xsl:template>
468
469<xsl:template match="sect3">
470  <xsl:variable name="id">
471    <xsl:call-template name="object.id"/>
472  </xsl:variable>
473
474  <xsl:element name="fo:{$section.container.element}"
475               use-attribute-sets="section.level3.properties">
476    <xsl:attribute name="id"><xsl:value-of 
477                        select="$id"/></xsl:attribute>
478    <xsl:call-template name="sect3.titlepage"/>
479
480    <xsl:variable name="toc.params">
481      <xsl:call-template name="find.path.params">
482        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
483      </xsl:call-template>
484    </xsl:variable>
485
486    <xsl:if test="contains($toc.params, 'toc')
487                  and $generate.section.toc.level &gt;= 3">
488      <xsl:call-template name="section.toc">
489        <xsl:with-param name="toc.title.p" 
490                        select="contains($toc.params, 'title')"/>
491      </xsl:call-template>
492      <xsl:call-template name="section.toc.separator"/>
493    </xsl:if>
494
495    <xsl:apply-templates/>
496  </xsl:element>
497</xsl:template>
498
499<xsl:template match="sect4">
500  <xsl:variable name="id">
501    <xsl:call-template name="object.id"/>
502  </xsl:variable>
503
504  <xsl:element name="fo:{$section.container.element}"
505               use-attribute-sets="section.level4.properties">
506    <xsl:attribute name="id"><xsl:value-of 
507                        select="$id"/></xsl:attribute>
508    <xsl:call-template name="sect4.titlepage"/>
509
510    <xsl:variable name="toc.params">
511      <xsl:call-template name="find.path.params">
512        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
513      </xsl:call-template>
514    </xsl:variable>
515
516    <xsl:if test="contains($toc.params, 'toc')
517                  and $generate.section.toc.level &gt;= 4">
518      <xsl:call-template name="section.toc">
519        <xsl:with-param name="toc.title.p" 
520                        select="contains($toc.params, 'title')"/>
521      </xsl:call-template>
522      <xsl:call-template name="section.toc.separator"/>
523    </xsl:if>
524
525    <xsl:apply-templates/>
526  </xsl:element>
527</xsl:template>
528
529<xsl:template match="sect5">
530  <xsl:variable name="id">
531    <xsl:call-template name="object.id"/>
532  </xsl:variable>
533
534  <xsl:element name="fo:{$section.container.element}"
535               use-attribute-sets="section.level5.properties">
536    <xsl:attribute name="id"><xsl:value-of 
537                        select="$id"/></xsl:attribute>
538    <xsl:call-template name="sect5.titlepage"/>
539
540    <xsl:variable name="toc.params">
541      <xsl:call-template name="find.path.params">
542        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
543      </xsl:call-template>
544    </xsl:variable>
545
546    <xsl:if test="contains($toc.params, 'toc')
547                  and $generate.section.toc.level &gt;= 5">
548      <xsl:call-template name="section.toc">
549        <xsl:with-param name="toc.title.p" 
550                        select="contains($toc.params, 'title')"/>
551      </xsl:call-template>
552      <xsl:call-template name="section.toc.separator"/>
553    </xsl:if>
554
555    <xsl:apply-templates/>
556  </xsl:element>
557</xsl:template>
558
559<xsl:template match="simplesect">
560  <xsl:variable name="id">
561    <xsl:call-template name="object.id"/>
562  </xsl:variable>
563
564  <xsl:element name="fo:{$section.container.element}">
565    <xsl:attribute name="id"><xsl:value-of 
566                        select="$id"/></xsl:attribute>
567    <xsl:call-template name="simplesect.titlepage"/>
568    <xsl:apply-templates/>
569  </xsl:element>
570</xsl:template>
571
572<xsl:template match="sectioninfo"></xsl:template>
573<xsl:template match="section/info"></xsl:template>
574<xsl:template match="section/title"></xsl:template>
575<xsl:template match="section/titleabbrev"></xsl:template>
576<xsl:template match="section/subtitle"></xsl:template>
577
578<xsl:template match="sect1info"></xsl:template>
579<xsl:template match="sect1/info"></xsl:template>
580<xsl:template match="sect1/title"></xsl:template>
581<xsl:template match="sect1/titleabbrev"></xsl:template>
582<xsl:template match="sect1/subtitle"></xsl:template>
583
584<xsl:template match="sect2info"></xsl:template>
585<xsl:template match="sect2/info"></xsl:template>
586<xsl:template match="sect2/title"></xsl:template>
587<xsl:template match="sect2/titleabbrev"></xsl:template>
588<xsl:template match="sect2/subtitle"></xsl:template>
589
590<xsl:template match="sect3info"></xsl:template>
591<xsl:template match="sect3/info"></xsl:template>
592<xsl:template match="sect3/title"></xsl:template>
593<xsl:template match="sect3/titleabbrev"></xsl:template>
594<xsl:template match="sect3/subtitle"></xsl:template>
595
596<xsl:template match="sect4info"></xsl:template>
597<xsl:template match="sect4/info"></xsl:template>
598<xsl:template match="sect4/title"></xsl:template>
599<xsl:template match="sect4/titleabbrev"></xsl:template>
600<xsl:template match="sect4/subtitle"></xsl:template>
601
602<xsl:template match="sect5info"></xsl:template>
603<xsl:template match="sect5/info"></xsl:template>
604<xsl:template match="sect5/title"></xsl:template>
605<xsl:template match="sect5/titleabbrev"></xsl:template>
606<xsl:template match="sect5/subtitle"></xsl:template>
607
608<xsl:template match="simplesect/info"></xsl:template>
609<xsl:template match="simplesect/title"></xsl:template>
610<xsl:template match="simplesect/titleabbrev"></xsl:template>
611<xsl:template match="simplesect/subtitle"></xsl:template>
612
613<!-- ==================================================================== -->
614
615<xsl:template name="section.heading">
616  <xsl:param name="level" select="1"/>
617  <xsl:param name="marker" select="1"/>
618  <xsl:param name="title"/>
619  <xsl:param name="marker.title"/>
620
621  <fo:block xsl:use-attribute-sets="section.title.properties">
622    <xsl:if test="$marker != 0">
623      <fo:marker marker-class-name="section.head.marker">
624        <xsl:copy-of select="$marker.title"/>
625      </fo:marker>
626    </xsl:if>
627
628    <xsl:choose>
629      <xsl:when test="$level=1">
630        <fo:block xsl:use-attribute-sets="section.title.level1.properties">
631          <xsl:copy-of select="$title"/>
632        </fo:block>
633      </xsl:when>
634      <xsl:when test="$level=2">
635        <fo:block xsl:use-attribute-sets="section.title.level2.properties">
636          <xsl:copy-of select="$title"/>
637        </fo:block>
638      </xsl:when>
639      <xsl:when test="$level=3">
640        <fo:block xsl:use-attribute-sets="section.title.level3.properties">
641          <xsl:copy-of select="$title"/>
642        </fo:block>
643      </xsl:when>
644      <xsl:when test="$level=4">
645        <fo:block xsl:use-attribute-sets="section.title.level4.properties">
646          <xsl:copy-of select="$title"/>
647        </fo:block>
648      </xsl:when>
649      <xsl:when test="$level=5">
650        <fo:block xsl:use-attribute-sets="section.title.level5.properties">
651          <xsl:copy-of select="$title"/>
652        </fo:block>
653      </xsl:when>
654      <xsl:otherwise>
655        <fo:block xsl:use-attribute-sets="section.title.level6.properties">
656          <xsl:copy-of select="$title"/>
657        </fo:block>
658      </xsl:otherwise>
659    </xsl:choose>
660  </fo:block>
661</xsl:template>
662
663<!-- ==================================================================== -->
664
665<xsl:template match="bridgehead">
666  <xsl:variable name="container"
667                select="(ancestor::appendix
668                        |ancestor::article
669                        |ancestor::bibliography
670                        |ancestor::chapter
671                        |ancestor::glossary
672                        |ancestor::glossdiv
673                        |ancestor::index
674                        |ancestor::partintro
675                        |ancestor::preface
676                        |ancestor::refsect1
677                        |ancestor::refsect2
678                        |ancestor::refsect3
679                        |ancestor::sect1
680                        |ancestor::sect2
681                        |ancestor::sect3
682                        |ancestor::sect4
683                        |ancestor::sect5
684                        |ancestor::section
685                        |ancestor::setindex
686                        |ancestor::simplesect)[last()]"/>
687
688  <xsl:variable name="clevel">
689    <xsl:choose>
690      <xsl:when test="local-name($container) = 'appendix'
691                      or local-name($container) = 'chapter'
692                      or local-name($container) = 'article'
693                      or local-name($container) = 'bibliography'
694                      or local-name($container) = 'glossary'
695                      or local-name($container) = 'index'
696                      or local-name($container) = 'partintro'
697                      or local-name($container) = 'preface'
698                      or local-name($container) = 'setindex'">2</xsl:when>
699      <xsl:when test="local-name($container) = 'glossdiv'">
700        <xsl:value-of select="count(ancestor::glossdiv)+2"/>
701      </xsl:when>
702      <xsl:when test="local-name($container) = 'sect1'
703                      or local-name($container) = 'sect2'
704                      or local-name($container) = 'sect3'
705                      or local-name($container) = 'sect4'
706                      or local-name($container) = 'sect5'
707                      or local-name($container) = 'refsect1'
708                      or local-name($container) = 'refsect2'
709                      or local-name($container) = 'refsect3'
710                      or local-name($container) = 'section'
711                      or local-name($container) = 'simplesect'">
712        <xsl:variable name="slevel">
713          <xsl:call-template name="section.level">
714            <xsl:with-param name="node" select="$container"/>
715          </xsl:call-template>
716        </xsl:variable>
717        <xsl:value-of select="$slevel + 1"/>
718      </xsl:when>
719      <xsl:otherwise>2</xsl:otherwise>
720    </xsl:choose>
721  </xsl:variable>
722
723  <xsl:variable name="level">
724    <xsl:choose>
725      <xsl:when test="@renderas = 'sect1'">1</xsl:when>
726      <xsl:when test="@renderas = 'sect2'">2</xsl:when>
727      <xsl:when test="@renderas = 'sect3'">3</xsl:when>
728      <xsl:when test="@renderas = 'sect4'">4</xsl:when>
729      <xsl:when test="@renderas = 'sect5'">5</xsl:when>
730      <xsl:otherwise>
731        <xsl:value-of select="$clevel"/>
732      </xsl:otherwise>
733    </xsl:choose>
734  </xsl:variable>
735
736  <xsl:variable name="marker">
737    <xsl:choose>
738      <xsl:when test="$level &lt;= $marker.section.level">1</xsl:when>
739      <xsl:otherwise>0</xsl:otherwise>
740    </xsl:choose>
741  </xsl:variable>
742
743  <xsl:variable name="marker.title">
744    <xsl:apply-templates/>
745  </xsl:variable>
746
747  <xsl:variable name="id">
748    <xsl:call-template name="object.id"/>
749  </xsl:variable>
750
751  <fo:block id="{$id}">
752    <xsl:call-template name="section.heading">
753      <xsl:with-param name="level" select="$level"/>
754      <xsl:with-param name="title">
755        <xsl:apply-templates/>
756      </xsl:with-param>
757      <xsl:with-param name="marker" select="$marker"/>
758      <xsl:with-param name="marker.title" select="$marker.title"/>
759    </xsl:call-template>
760  </fo:block>
761</xsl:template>
762
763</xsl:stylesheet>
764
Note: See TracBrowser for help on using the repository browser.