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