1<?xml version='1.0'?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                version='1.0'>
4
5<!-- ********************************************************************
6     $Id: division.xsl,v 1.12 2006/05/04 12:21:28 kosek Exp $
7     ********************************************************************
8
9     This file is part of the XSL DocBook Stylesheet distribution.
10     See /README or http://nwalsh.com/docbook/xsl/ for copyright
11     and other information.
12
13     ******************************************************************** -->
14
15<!-- ==================================================================== -->
16
17<xsl:template match="set">
18  <xsl:call-template name="id.warning"/>
19
20  <div class="{name(.)}">
21    <xsl:call-template name="dir">
22      <xsl:with-param name="inherit" select="1"/>
23    </xsl:call-template>
24    <xsl:call-template name="language.attribute"/>
25    <xsl:if test="$generate.id.attributes != 0">
26      <xsl:attribute name="id">
27        <xsl:call-template name="object.id"/>
28      </xsl:attribute>
29    </xsl:if>
30
31    <xsl:call-template name="set.titlepage"/>
32
33    <xsl:variable name="toc.params">
34      <xsl:call-template name="find.path.params">
35	<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
36      </xsl:call-template>
37    </xsl:variable>
38
39    <xsl:call-template name="make.lots">
40      <xsl:with-param name="toc.params" select="$toc.params"/>
41      <xsl:with-param name="toc">
42        <xsl:call-template name="set.toc">
43	  <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
44	</xsl:call-template>
45      </xsl:with-param>
46    </xsl:call-template>
47
48    <xsl:apply-templates/>
49  </div>
50</xsl:template>
51
52<xsl:template match="set/setinfo"></xsl:template>
53<xsl:template match="set/title"></xsl:template>
54<xsl:template match="set/titleabbrev"></xsl:template>
55<xsl:template match="set/subtitle"></xsl:template>
56
57<!-- ==================================================================== -->
58
59<xsl:template match="book">
60  <xsl:call-template name="id.warning"/>
61
62  <div class="{name(.)}">
63    <xsl:call-template name="dir">
64      <xsl:with-param name="inherit" select="1"/>
65    </xsl:call-template>
66    <xsl:call-template name="language.attribute"/>
67    <xsl:if test="$generate.id.attributes != 0">
68      <xsl:attribute name="id">
69        <xsl:call-template name="object.id"/>
70      </xsl:attribute>
71    </xsl:if>
72
73    <xsl:call-template name="book.titlepage"/>
74
75    <xsl:apply-templates select="dedication" mode="dedication"/>
76
77    <xsl:variable name="toc.params">
78      <xsl:call-template name="find.path.params">
79	<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
80      </xsl:call-template>
81    </xsl:variable>
82
83    <xsl:call-template name="make.lots">
84      <xsl:with-param name="toc.params" select="$toc.params"/>
85      <xsl:with-param name="toc">
86        <xsl:call-template name="division.toc">
87	  <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
88	</xsl:call-template>
89      </xsl:with-param>
90    </xsl:call-template>
91
92    <xsl:apply-templates/>
93  </div>
94</xsl:template>
95
96<xsl:template match="book/bookinfo"></xsl:template>
97<xsl:template match="book/title"></xsl:template>
98<xsl:template match="book/titleabbrev"></xsl:template>
99<xsl:template match="book/subtitle"></xsl:template>
100
101<!-- ==================================================================== -->
102
103<xsl:template match="part">
104  <xsl:call-template name="id.warning"/>
105
106  <div class="{name(.)}">
107    <xsl:call-template name="dir">
108      <xsl:with-param name="inherit" select="1"/>
109    </xsl:call-template>
110    <xsl:call-template name="language.attribute"/>
111    <xsl:if test="$generate.id.attributes != 0">
112      <xsl:attribute name="id">
113        <xsl:call-template name="object.id"/>
114      </xsl:attribute>
115    </xsl:if>
116
117    <xsl:call-template name="part.titlepage"/>
118
119    <xsl:variable name="toc.params">
120      <xsl:call-template name="find.path.params">
121        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
122      </xsl:call-template>
123    </xsl:variable>
124    <xsl:if test="not(partintro) and contains($toc.params, 'toc')">
125      <xsl:call-template name="division.toc"/>
126    </xsl:if>
127    <xsl:apply-templates/>
128  </div>
129</xsl:template>
130
131<xsl:template match="part" mode="make.part.toc">
132  <xsl:call-template name="division.toc"/>
133</xsl:template>
134
135<xsl:template match="reference" mode="make.part.toc">
136  <xsl:call-template name="division.toc"/>
137</xsl:template>
138
139<xsl:template match="part/docinfo"></xsl:template>
140<xsl:template match="part/partinfo"></xsl:template>
141<xsl:template match="part/title"></xsl:template>
142<xsl:template match="part/titleabbrev"></xsl:template>
143<xsl:template match="part/subtitle"></xsl:template>
144
145<xsl:template match="partintro">
146  <xsl:call-template name="id.warning"/>
147
148  <div class="{name(.)}">
149    <xsl:call-template name="dir">
150      <xsl:with-param name="inherit" select="1"/>
151    </xsl:call-template>
152    <xsl:call-template name="language.attribute"/>
153    <xsl:if test="$generate.id.attributes != 0">
154      <xsl:attribute name="id">
155        <xsl:call-template name="object.id"/>
156      </xsl:attribute>
157    </xsl:if>
158
159    <xsl:call-template name="partintro.titlepage"/>
160    <xsl:apply-templates/>
161
162    <xsl:variable name="toc.params">
163      <xsl:call-template name="find.path.params">
164        <xsl:with-param name="node" select="parent::*"/>
165        <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
166      </xsl:call-template>
167    </xsl:variable>
168    <xsl:if test="contains($toc.params, 'toc')">
169      <!-- not ancestor::part because partintro appears in reference -->
170      <xsl:apply-templates select="parent::*" mode="make.part.toc"/>
171    </xsl:if>
172    <xsl:call-template name="process.footnotes"/>
173  </div>
174</xsl:template>
175
176<xsl:template match="partintro/title"></xsl:template>
177<xsl:template match="partintro/titleabbrev"></xsl:template>
178<xsl:template match="partintro/subtitle"></xsl:template>
179
180<xsl:template match="partintro/title" mode="partintro.title.mode">
181  <h2>
182    <xsl:apply-templates/>
183  </h2>
184</xsl:template>
185
186<xsl:template match="partintro/subtitle" mode="partintro.title.mode">
187  <h3>
188    <i><xsl:apply-templates/></i>
189  </h3>
190</xsl:template>
191
192<!-- ==================================================================== -->
193
194<xsl:template match="book" mode="division.number">
195  <xsl:number from="set" count="book" format="1."/>
196</xsl:template>
197
198<xsl:template match="part" mode="division.number">
199  <xsl:number from="book" count="part" format="I."/>
200</xsl:template>
201
202<!-- ==================================================================== -->
203
204<xsl:template name="division.title">
205  <xsl:param name="node" select="."/>
206
207  <h1>
208    <xsl:attribute name="class">title</xsl:attribute>
209    <xsl:call-template name="anchor">
210      <xsl:with-param name="node" select="$node"/>
211      <xsl:with-param name="conditional" select="0"/>
212    </xsl:call-template>
213    <xsl:apply-templates select="$node" mode="object.title.markup">
214      <xsl:with-param name="allow-anchors" select="1"/>
215    </xsl:apply-templates>
216  </h1>
217</xsl:template>
218
219</xsl:stylesheet>
220
221