2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
4
<!--############################################################################
5
XSLT Stylesheet DocBook -> LaTeX
6
############################################################################ -->
8
<xsl:template match="sect1|sect2|sect3|sect4|sect5">
9
<xsl:call-template name="element.and.label"/>
10
<xsl:apply-templates/>
13
<xsl:template match="sect1/title"/>
14
<xsl:template match="sect2/title"/>
15
<xsl:template match="sect3/title"/>
16
<xsl:template match="sect4/title"/>
17
<xsl:template match="sect5/title"/>
19
<xsl:template name="map.sect.level">
20
<xsl:param name="level" select="''"/>
21
<xsl:param name="name" select="''"/>
22
<xsl:param name="num" select="'1'"/>
23
<xsl:text> </xsl:text>
25
<xsl:when test="$level < 6">
27
<xsl:when test='$level=1'>\section</xsl:when>
28
<xsl:when test='$level=2'>\subsection</xsl:when>
29
<xsl:when test='$level=3'>\subsubsection</xsl:when>
30
<xsl:when test='$level=4'>\paragraph</xsl:when>
31
<xsl:when test='$level=5'>\subparagraph</xsl:when>
33
<xsl:when test='$level=0'>\chapter</xsl:when>
36
<xsl:when test="$name!=''">
38
<xsl:when test="$name='sect1'">\section</xsl:when>
39
<xsl:when test="$name='sect2'">\subsection</xsl:when>
40
<xsl:when test="$name='sect3'">\subsubsection</xsl:when>
41
<xsl:when test="$name='sect4'">\paragraph</xsl:when>
42
<xsl:when test="$name='sect5'">\subparagraph</xsl:when>
46
<xsl:message>*** section level > 6 not well supported</xsl:message>
47
<xsl:text>\subparagraph</xsl:text>
51
<xsl:when test="$num = '0'">
52
<xsl:text>*</xsl:text>
54
<xsl:when test="ancestor::preface|ancestor::colophon|
55
ancestor::dedication|ancestor::partintro|
56
ancestor::glossary|ancestor::qandaset">
57
<xsl:text>*</xsl:text>
62
<xsl:template match="section">
63
<xsl:variable name="min">
65
<xsl:when test="ancestor::appendix and ancestor::article">
66
<xsl:value-of select="'2'"/>
69
<xsl:value-of select="'1'"/>
73
<xsl:call-template name="map.sect.level">
74
<xsl:with-param name="level" select="count(ancestor::section)+$min"/>
76
<xsl:call-template name="title.and.label"/>
77
<xsl:apply-templates/>
80
<xsl:template name="get.sect.level">
81
<xsl:param name="n" select="."/>
83
<xsl:when test="$n/parent::section">
84
<xsl:value-of select="count($n/ancestor::section)+1"/>
86
<xsl:when test="$n/parent::chapter">1</xsl:when>
87
<xsl:when test="$n/parent::article">1</xsl:when>
88
<xsl:when test="$n/parent::sect1">2</xsl:when>
89
<xsl:when test="$n/parent::sect2">3</xsl:when>
90
<xsl:when test="$n/parent::sect3">4</xsl:when>
91
<xsl:when test="$n/parent::sect4">5</xsl:when>
92
<xsl:when test="$n/parent::sect5">6</xsl:when>
93
<xsl:when test="$n/parent::reference">1</xsl:when>
94
<xsl:when test="$n/parent::preface">1</xsl:when>
95
<xsl:when test="$n/parent::simplesect">
96
<xsl:variable name="l">
97
<xsl:call-template name="get.sect.level">
98
<xsl:with-param name="n" select="$n/parent::simplesect"/>
101
<xsl:value-of select="$l+1"/>
103
<xsl:when test="$n/parent::book">0</xsl:when>
104
<xsl:when test="$n/parent::part">0</xsl:when>
105
<xsl:otherwise>7</xsl:otherwise>
109
<xsl:template match="simplesect">
110
<xsl:call-template name="map.sect.level">
111
<xsl:with-param name="level">
112
<xsl:call-template name="get.sect.level"/>
115
<xsl:call-template name="title.and.label"/>
116
<xsl:apply-templates/>
119
<xsl:template match="section/title"/>
120
<xsl:template match="simplesect/title"/>
122
<xsl:template match="sectioninfo"/>
123
<xsl:template match="sect1info"/>
124
<xsl:template match="sect2info"/>
125
<xsl:template match="sect3info"/>
126
<xsl:template match="sect4info"/>
127
<xsl:template match="sect5info"/>
129
<xsl:template match="titleabbrev"/>