| 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: sections.xsl 7000 2007-07-10 20:41:35Z mzjn $ |
| 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="section"> |
| 18 |
<xsl:variable name="depth" select="count(ancestor::section)+1"/> |
| 19 |
|
| 20 |
<xsl:call-template name="id.warning"/> |
| 21 |
|
| 22 |
<div> |
| 23 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 24 |
<xsl:call-template name="dir"> |
| 25 |
<xsl:with-param name="inherit" select="1"/> |
| 26 |
</xsl:call-template> |
| 27 |
<xsl:call-template name="language.attribute"/> |
| 28 |
<xsl:call-template name="section.titlepage"/> |
| 29 |
|
| 30 |
<xsl:variable name="toc.params"> |
| 31 |
<xsl:call-template name="find.path.params"> |
| 32 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 33 |
</xsl:call-template> |
| 34 |
</xsl:variable> |
| 35 |
|
| 36 |
<xsl:if test="contains($toc.params, 'toc') |
| 37 |
and $depth <= $generate.section.toc.level"> |
| 38 |
<xsl:call-template name="section.toc"> |
| 39 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 40 |
</xsl:call-template> |
| 41 |
<xsl:call-template name="section.toc.separator"/> |
| 42 |
</xsl:if> |
| 43 |
<xsl:apply-templates/> |
| 44 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 45 |
</div> |
| 46 |
</xsl:template> |
| 47 |
|
| 48 |
<xsl:template name="section.title"> |
| 49 |
<!-- the context node should be the title of a section when called --> |
| 50 |
<xsl:variable name="section" select="(ancestor::section |
| 51 |
|ancestor::simplesect |
| 52 |
|ancestor::sect1 |
| 53 |
|ancestor::sect2 |
| 54 |
|ancestor::sect3 |
| 55 |
|ancestor::sect4 |
| 56 |
|ancestor::sect5)[last()]"/> |
| 57 |
|
| 58 |
<xsl:variable name="renderas"> |
| 59 |
<xsl:choose> |
| 60 |
<xsl:when test="$section/@renderas = 'sect1'">1</xsl:when> |
| 61 |
<xsl:when test="$section/@renderas = 'sect2'">2</xsl:when> |
| 62 |
<xsl:when test="$section/@renderas = 'sect3'">3</xsl:when> |
| 63 |
<xsl:when test="$section/@renderas = 'sect4'">4</xsl:when> |
| 64 |
<xsl:when test="$section/@renderas = 'sect5'">5</xsl:when> |
| 65 |
<xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise> |
| 66 |
</xsl:choose> |
| 67 |
</xsl:variable> |
| 68 |
|
| 69 |
<xsl:variable name="level"> |
| 70 |
<xsl:choose> |
| 71 |
<xsl:when test="$renderas != ''"> |
| 72 |
<xsl:value-of select="$renderas"/> |
| 73 |
</xsl:when> |
| 74 |
<xsl:otherwise> |
| 75 |
<xsl:call-template name="section.level"> |
| 76 |
<xsl:with-param name="node" select="$section"/> |
| 77 |
</xsl:call-template> |
| 78 |
</xsl:otherwise> |
| 79 |
</xsl:choose> |
| 80 |
</xsl:variable> |
| 81 |
|
| 82 |
<xsl:call-template name="section.heading"> |
| 83 |
<xsl:with-param name="section" select="$section"/> |
| 84 |
<xsl:with-param name="level" select="$level"/> |
| 85 |
<xsl:with-param name="title"> |
| 86 |
<xsl:apply-templates select="$section" mode="object.title.markup"> |
| 87 |
<xsl:with-param name="allow-anchors" select="1"/> |
| 88 |
</xsl:apply-templates> |
| 89 |
</xsl:with-param> |
| 90 |
</xsl:call-template> |
| 91 |
</xsl:template> |
| 92 |
|
| 93 |
<xsl:template match="section/title |
| 94 |
|section/info/title |
| 95 |
|sectioninfo/title" |
| 96 |
mode="titlepage.mode" priority="2"> |
| 97 |
<xsl:call-template name="section.title"/> |
| 98 |
</xsl:template> |
| 99 |
|
| 100 |
<xsl:template match="sect1"> |
| 101 |
<xsl:call-template name="id.warning"/> |
| 102 |
|
| 103 |
<div> |
| 104 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 105 |
<xsl:call-template name="dir"> |
| 106 |
<xsl:with-param name="inherit" select="1"/> |
| 107 |
</xsl:call-template> |
| 108 |
<xsl:call-template name="language.attribute"/> |
| 109 |
|
| 110 |
<xsl:choose> |
| 111 |
<xsl:when test="@renderas = 'sect2'"> |
| 112 |
<xsl:call-template name="sect2.titlepage"/> |
| 113 |
</xsl:when> |
| 114 |
<xsl:when test="@renderas = 'sect3'"> |
| 115 |
<xsl:call-template name="sect3.titlepage"/> |
| 116 |
</xsl:when> |
| 117 |
<xsl:when test="@renderas = 'sect4'"> |
| 118 |
<xsl:call-template name="sect4.titlepage"/> |
| 119 |
</xsl:when> |
| 120 |
<xsl:when test="@renderas = 'sect5'"> |
| 121 |
<xsl:call-template name="sect5.titlepage"/> |
| 122 |
</xsl:when> |
| 123 |
<xsl:otherwise> |
| 124 |
<xsl:call-template name="sect1.titlepage"/> |
| 125 |
</xsl:otherwise> |
| 126 |
</xsl:choose> |
| 127 |
|
| 128 |
<xsl:variable name="toc.params"> |
| 129 |
<xsl:call-template name="find.path.params"> |
| 130 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 131 |
</xsl:call-template> |
| 132 |
</xsl:variable> |
| 133 |
|
| 134 |
<xsl:if test="contains($toc.params, 'toc') |
| 135 |
and $generate.section.toc.level >= 1"> |
| 136 |
<xsl:call-template name="section.toc"> |
| 137 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 138 |
</xsl:call-template> |
| 139 |
<xsl:call-template name="section.toc.separator"/> |
| 140 |
</xsl:if> |
| 141 |
<xsl:apply-templates/> |
| 142 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 143 |
</div> |
| 144 |
</xsl:template> |
| 145 |
|
| 146 |
<xsl:template match="sect1/title |
| 147 |
|sect1/info/title |
| 148 |
|sect1info/title" |
| 149 |
mode="titlepage.mode" priority="2"> |
| 150 |
<xsl:call-template name="section.title"/> |
| 151 |
</xsl:template> |
| 152 |
|
| 153 |
<xsl:template match="sect2"> |
| 154 |
<xsl:call-template name="id.warning"/> |
| 155 |
|
| 156 |
<div> |
| 157 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 158 |
<xsl:call-template name="dir"> |
| 159 |
<xsl:with-param name="inherit" select="1"/> |
| 160 |
</xsl:call-template> |
| 161 |
<xsl:call-template name="language.attribute"/> |
| 162 |
|
| 163 |
<xsl:choose> |
| 164 |
<xsl:when test="@renderas = 'sect1'"> |
| 165 |
<xsl:call-template name="sect1.titlepage"/> |
| 166 |
</xsl:when> |
| 167 |
<xsl:when test="@renderas = 'sect3'"> |
| 168 |
<xsl:call-template name="sect3.titlepage"/> |
| 169 |
</xsl:when> |
| 170 |
<xsl:when test="@renderas = 'sect4'"> |
| 171 |
<xsl:call-template name="sect4.titlepage"/> |
| 172 |
</xsl:when> |
| 173 |
<xsl:when test="@renderas = 'sect5'"> |
| 174 |
<xsl:call-template name="sect5.titlepage"/> |
| 175 |
</xsl:when> |
| 176 |
<xsl:otherwise> |
| 177 |
<xsl:call-template name="sect2.titlepage"/> |
| 178 |
</xsl:otherwise> |
| 179 |
</xsl:choose> |
| 180 |
|
| 181 |
<xsl:variable name="toc.params"> |
| 182 |
<xsl:call-template name="find.path.params"> |
| 183 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 184 |
</xsl:call-template> |
| 185 |
</xsl:variable> |
| 186 |
|
| 187 |
<xsl:if test="contains($toc.params, 'toc') |
| 188 |
and $generate.section.toc.level >= 2"> |
| 189 |
<xsl:call-template name="section.toc"> |
| 190 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 191 |
</xsl:call-template> |
| 192 |
<xsl:call-template name="section.toc.separator"/> |
| 193 |
</xsl:if> |
| 194 |
<xsl:apply-templates/> |
| 195 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 196 |
</div> |
| 197 |
</xsl:template> |
| 198 |
|
| 199 |
<xsl:template match="sect2/title |
| 200 |
|sect2/info/title |
| 201 |
|sect2info/title" |
| 202 |
mode="titlepage.mode" priority="2"> |
| 203 |
<xsl:call-template name="section.title"/> |
| 204 |
</xsl:template> |
| 205 |
|
| 206 |
<xsl:template match="sect3"> |
| 207 |
<xsl:call-template name="id.warning"/> |
| 208 |
|
| 209 |
<div> |
| 210 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 211 |
<xsl:call-template name="dir"> |
| 212 |
<xsl:with-param name="inherit" select="1"/> |
| 213 |
</xsl:call-template> |
| 214 |
<xsl:call-template name="language.attribute"/> |
| 215 |
|
| 216 |
<xsl:choose> |
| 217 |
<xsl:when test="@renderas = 'sect1'"> |
| 218 |
<xsl:call-template name="sect1.titlepage"/> |
| 219 |
</xsl:when> |
| 220 |
<xsl:when test="@renderas = 'sect2'"> |
| 221 |
<xsl:call-template name="sect2.titlepage"/> |
| 222 |
</xsl:when> |
| 223 |
<xsl:when test="@renderas = 'sect4'"> |
| 224 |
<xsl:call-template name="sect4.titlepage"/> |
| 225 |
</xsl:when> |
| 226 |
<xsl:when test="@renderas = 'sect5'"> |
| 227 |
<xsl:call-template name="sect5.titlepage"/> |
| 228 |
</xsl:when> |
| 229 |
<xsl:otherwise> |
| 230 |
<xsl:call-template name="sect3.titlepage"/> |
| 231 |
</xsl:otherwise> |
| 232 |
</xsl:choose> |
| 233 |
|
| 234 |
<xsl:variable name="toc.params"> |
| 235 |
<xsl:call-template name="find.path.params"> |
| 236 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 237 |
</xsl:call-template> |
| 238 |
</xsl:variable> |
| 239 |
|
| 240 |
<xsl:if test="contains($toc.params, 'toc') |
| 241 |
and $generate.section.toc.level >= 3"> |
| 242 |
<xsl:call-template name="section.toc"> |
| 243 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 244 |
</xsl:call-template> |
| 245 |
<xsl:call-template name="section.toc.separator"/> |
| 246 |
</xsl:if> |
| 247 |
<xsl:apply-templates/> |
| 248 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 249 |
</div> |
| 250 |
</xsl:template> |
| 251 |
|
| 252 |
<xsl:template match="sect3/title |
| 253 |
|sect3/info/title |
| 254 |
|sect3info/title" |
| 255 |
mode="titlepage.mode" priority="2"> |
| 256 |
<xsl:call-template name="section.title"/> |
| 257 |
</xsl:template> |
| 258 |
|
| 259 |
<xsl:template match="sect4"> |
| 260 |
<xsl:call-template name="id.warning"/> |
| 261 |
|
| 262 |
<div> |
| 263 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 264 |
<xsl:call-template name="dir"> |
| 265 |
<xsl:with-param name="inherit" select="1"/> |
| 266 |
</xsl:call-template> |
| 267 |
<xsl:call-template name="language.attribute"/> |
| 268 |
|
| 269 |
<xsl:choose> |
| 270 |
<xsl:when test="@renderas = 'sect1'"> |
| 271 |
<xsl:call-template name="sect1.titlepage"/> |
| 272 |
</xsl:when> |
| 273 |
<xsl:when test="@renderas = 'sect2'"> |
| 274 |
<xsl:call-template name="sect2.titlepage"/> |
| 275 |
</xsl:when> |
| 276 |
<xsl:when test="@renderas = 'sect3'"> |
| 277 |
<xsl:call-template name="sect3.titlepage"/> |
| 278 |
</xsl:when> |
| 279 |
<xsl:when test="@renderas = 'sect5'"> |
| 280 |
<xsl:call-template name="sect5.titlepage"/> |
| 281 |
</xsl:when> |
| 282 |
<xsl:otherwise> |
| 283 |
<xsl:call-template name="sect4.titlepage"/> |
| 284 |
</xsl:otherwise> |
| 285 |
</xsl:choose> |
| 286 |
|
| 287 |
<xsl:variable name="toc.params"> |
| 288 |
<xsl:call-template name="find.path.params"> |
| 289 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 290 |
</xsl:call-template> |
| 291 |
</xsl:variable> |
| 292 |
|
| 293 |
<xsl:if test="contains($toc.params, 'toc') |
| 294 |
and $generate.section.toc.level >= 4"> |
| 295 |
<xsl:call-template name="section.toc"> |
| 296 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 297 |
</xsl:call-template> |
| 298 |
<xsl:call-template name="section.toc.separator"/> |
| 299 |
</xsl:if> |
| 300 |
<xsl:apply-templates/> |
| 301 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 302 |
</div> |
| 303 |
</xsl:template> |
| 304 |
|
| 305 |
<xsl:template match="sect4/title |
| 306 |
|sect4/info/title |
| 307 |
|sect4info/title" |
| 308 |
mode="titlepage.mode" priority="2"> |
| 309 |
<xsl:call-template name="section.title"/> |
| 310 |
</xsl:template> |
| 311 |
|
| 312 |
<xsl:template match="sect5"> |
| 313 |
<xsl:call-template name="id.warning"/> |
| 314 |
|
| 315 |
<div> |
| 316 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 317 |
<xsl:call-template name="dir"> |
| 318 |
<xsl:with-param name="inherit" select="1"/> |
| 319 |
</xsl:call-template> |
| 320 |
<xsl:call-template name="language.attribute"/> |
| 321 |
|
| 322 |
<xsl:choose> |
| 323 |
<xsl:when test="@renderas = 'sect1'"> |
| 324 |
<xsl:call-template name="sect1.titlepage"/> |
| 325 |
</xsl:when> |
| 326 |
<xsl:when test="@renderas = 'sect2'"> |
| 327 |
<xsl:call-template name="sect2.titlepage"/> |
| 328 |
</xsl:when> |
| 329 |
<xsl:when test="@renderas = 'sect3'"> |
| 330 |
<xsl:call-template name="sect3.titlepage"/> |
| 331 |
</xsl:when> |
| 332 |
<xsl:when test="@renderas = 'sect4'"> |
| 333 |
<xsl:call-template name="sect4.titlepage"/> |
| 334 |
</xsl:when> |
| 335 |
<xsl:otherwise> |
| 336 |
<xsl:call-template name="sect5.titlepage"/> |
| 337 |
</xsl:otherwise> |
| 338 |
</xsl:choose> |
| 339 |
|
| 340 |
<xsl:variable name="toc.params"> |
| 341 |
<xsl:call-template name="find.path.params"> |
| 342 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 343 |
</xsl:call-template> |
| 344 |
</xsl:variable> |
| 345 |
|
| 346 |
<xsl:if test="contains($toc.params, 'toc') |
| 347 |
and $generate.section.toc.level >= 5"> |
| 348 |
<xsl:call-template name="section.toc"> |
| 349 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 350 |
</xsl:call-template> |
| 351 |
<xsl:call-template name="section.toc.separator"/> |
| 352 |
</xsl:if> |
| 353 |
<xsl:apply-templates/> |
| 354 |
<xsl:call-template name="process.chunk.footnotes"/> |
| 355 |
</div> |
| 356 |
</xsl:template> |
| 357 |
|
| 358 |
<xsl:template match="sect5/title |
| 359 |
|sect5/info/title |
| 360 |
|sect5info/title" |
| 361 |
mode="titlepage.mode" priority="2"> |
| 362 |
<xsl:call-template name="section.title"/> |
| 363 |
</xsl:template> |
| 364 |
|
| 365 |
<xsl:template match="simplesect"> |
| 366 |
<xsl:call-template name="id.warning"/> |
| 367 |
|
| 368 |
<div> |
| 369 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 370 |
<xsl:call-template name="dir"> |
| 371 |
<xsl:with-param name="inherit" select="1"/> |
| 372 |
</xsl:call-template> |
| 373 |
<xsl:call-template name="language.attribute"/> |
| 374 |
<xsl:call-template name="simplesect.titlepage"/> |
| 375 |
<xsl:apply-templates/> |
| 376 |
</div> |
| 377 |
</xsl:template> |
| 378 |
|
| 379 |
<xsl:template match="simplesect/title|simplesect/info/title" |
| 380 |
mode="titlepage.mode" priority="2"> |
| 381 |
<xsl:call-template name="section.title"/> |
| 382 |
</xsl:template> |
| 383 |
|
| 384 |
<xsl:template match="section/title"></xsl:template> |
| 385 |
<xsl:template match="section/titleabbrev"></xsl:template> |
| 386 |
<xsl:template match="section/subtitle"></xsl:template> |
| 387 |
<xsl:template match="sectioninfo"></xsl:template> |
| 388 |
<xsl:template match="section/info"></xsl:template> |
| 389 |
|
| 390 |
<xsl:template match="sect1/title"></xsl:template> |
| 391 |
<xsl:template match="sect1/titleabbrev"></xsl:template> |
| 392 |
<xsl:template match="sect1/subtitle"></xsl:template> |
| 393 |
<xsl:template match="sect1info"></xsl:template> |
| 394 |
<xsl:template match="sect1/info"></xsl:template> |
| 395 |
|
| 396 |
<xsl:template match="sect2/title"></xsl:template> |
| 397 |
<xsl:template match="sect2/subtitle"></xsl:template> |
| 398 |
<xsl:template match="sect2/titleabbrev"></xsl:template> |
| 399 |
<xsl:template match="sect2info"></xsl:template> |
| 400 |
<xsl:template match="sect2/info"></xsl:template> |
| 401 |
|
| 402 |
<xsl:template match="sect3/title"></xsl:template> |
| 403 |
<xsl:template match="sect3/subtitle"></xsl:template> |
| 404 |
<xsl:template match="sect3/titleabbrev"></xsl:template> |
| 405 |
<xsl:template match="sect3info"></xsl:template> |
| 406 |
<xsl:template match="sect3/info"></xsl:template> |
| 407 |
|
| 408 |
<xsl:template match="sect4/title"></xsl:template> |
| 409 |
<xsl:template match="sect4/subtitle"></xsl:template> |
| 410 |
<xsl:template match="sect4/titleabbrev"></xsl:template> |
| 411 |
<xsl:template match="sect4info"></xsl:template> |
| 412 |
<xsl:template match="sect4/info"></xsl:template> |
| 413 |
|
| 414 |
<xsl:template match="sect5/title"></xsl:template> |
| 415 |
<xsl:template match="sect5/subtitle"></xsl:template> |
| 416 |
<xsl:template match="sect5/titleabbrev"></xsl:template> |
| 417 |
<xsl:template match="sect5info"></xsl:template> |
| 418 |
<xsl:template match="sect5/info"></xsl:template> |
| 419 |
|
| 420 |
<xsl:template match="simplesect/title"></xsl:template> |
| 421 |
<xsl:template match="simplesect/subtitle"></xsl:template> |
| 422 |
<xsl:template match="simplesect/titleabbrev"></xsl:template> |
| 423 |
<xsl:template match="simplesect/info"></xsl:template> |
| 424 |
|
| 425 |
<!-- ==================================================================== --> |
| 426 |
|
| 427 |
<xsl:template name="section.heading"> |
| 428 |
<xsl:param name="section" select="."/> |
| 429 |
<xsl:param name="level" select="1"/> |
| 430 |
<xsl:param name="allow-anchors" select="1"/> |
| 431 |
<xsl:param name="title"/> |
| 432 |
<xsl:param name="class" select="'title'"/> |
| 433 |
|
| 434 |
<xsl:variable name="id"> |
| 435 |
<xsl:choose> |
| 436 |
<!-- if title is in an *info wrapper, get the grandparent --> |
| 437 |
<xsl:when test="contains(local-name(..), 'info')"> |
| 438 |
<xsl:call-template name="object.id"> |
| 439 |
<xsl:with-param name="object" select="../.."/> |
| 440 |
</xsl:call-template> |
| 441 |
</xsl:when> |
| 442 |
<xsl:otherwise> |
| 443 |
<xsl:call-template name="object.id"> |
| 444 |
<xsl:with-param name="object" select=".."/> |
| 445 |
</xsl:call-template> |
| 446 |
</xsl:otherwise> |
| 447 |
</xsl:choose> |
| 448 |
</xsl:variable> |
| 449 |
|
| 450 |
<!-- HTML H level is one higher than section level --> |
| 451 |
<xsl:variable name="hlevel"> |
| 452 |
<xsl:choose> |
| 453 |
<!-- highest valid HTML H level is H6; so anything nested deeper |
| 454 |
than 5 levels down just becomes H6 --> |
| 455 |
<xsl:when test="$level > 5">6</xsl:when> |
| 456 |
<xsl:otherwise> |
| 457 |
<xsl:value-of select="$level + 1"/> |
| 458 |
</xsl:otherwise> |
| 459 |
</xsl:choose> |
| 460 |
</xsl:variable> |
| 461 |
<xsl:element name="h{$hlevel}"> |
| 462 |
<xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute> |
| 463 |
<xsl:if test="$css.decoration != '0'"> |
| 464 |
<xsl:if test="$hlevel<3"> |
| 465 |
<xsl:attribute name="style">clear: both</xsl:attribute> |
| 466 |
</xsl:if> |
| 467 |
</xsl:if> |
| 468 |
<xsl:if test="$allow-anchors != 0 and $generate.id.attributes = 0"> |
| 469 |
<xsl:call-template name="anchor"> |
| 470 |
<xsl:with-param name="node" select="$section"/> |
| 471 |
<xsl:with-param name="conditional" select="0"/> |
| 472 |
</xsl:call-template> |
| 473 |
</xsl:if> |
| 474 |
<xsl:if test="$generate.id.attributes != 0 and not(local-name(.) = 'appendix')"> |
| 475 |
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
| 476 |
</xsl:if> |
| 477 |
<xsl:copy-of select="$title"/> |
| 478 |
</xsl:element> |
| 479 |
</xsl:template> |
| 480 |
|
| 481 |
<!-- ==================================================================== --> |
| 482 |
|
| 483 |
<xsl:template match="bridgehead"> |
| 484 |
<xsl:variable name="container" |
| 485 |
select="(ancestor::appendix |
| 486 |
|ancestor::article |
| 487 |
|ancestor::bibliography |
| 488 |
|ancestor::chapter |
| 489 |
|ancestor::glossary |
| 490 |
|ancestor::glossdiv |
| 491 |
|ancestor::index |
| 492 |
|ancestor::partintro |
| 493 |
|ancestor::preface |
| 494 |
|ancestor::refsect1 |
| 495 |
|ancestor::refsect2 |
| 496 |
|ancestor::refsect3 |
| 497 |
|ancestor::sect1 |
| 498 |
|ancestor::sect2 |
| 499 |
|ancestor::sect3 |
| 500 |
|ancestor::sect4 |
| 501 |
|ancestor::sect5 |
| 502 |
|ancestor::section |
| 503 |
|ancestor::setindex |
| 504 |
|ancestor::simplesect)[last()]"/> |
| 505 |
|
| 506 |
<xsl:variable name="clevel"> |
| 507 |
<xsl:choose> |
| 508 |
<xsl:when test="local-name($container) = 'appendix' |
| 509 |
or local-name($container) = 'chapter' |
| 510 |
or local-name($container) = 'article' |
| 511 |
or local-name($container) = 'bibliography' |
| 512 |
or local-name($container) = 'glossary' |
| 513 |
or local-name($container) = 'index' |
| 514 |
or local-name($container) = 'partintro' |
| 515 |
or local-name($container) = 'preface' |
| 516 |
or local-name($container) = 'setindex'">1</xsl:when> |
| 517 |
<xsl:when test="local-name($container) = 'glossdiv'"> |
| 518 |
<xsl:value-of select="count(ancestor::glossdiv)+1"/> |
| 519 |
</xsl:when> |
| 520 |
<xsl:when test="local-name($container) = 'sect1' |
| 521 |
or local-name($container) = 'sect2' |
| 522 |
or local-name($container) = 'sect3' |
| 523 |
or local-name($container) = 'sect4' |
| 524 |
or local-name($container) = 'sect5' |
| 525 |
or local-name($container) = 'refsect1' |
| 526 |
or local-name($container) = 'refsect2' |
| 527 |
or local-name($container) = 'refsect3' |
| 528 |
or local-name($container) = 'section' |
| 529 |
or local-name($container) = 'simplesect'"> |
| 530 |
<xsl:variable name="slevel"> |
| 531 |
<xsl:call-template name="section.level"> |
| 532 |
<xsl:with-param name="node" select="$container"/> |
| 533 |
</xsl:call-template> |
| 534 |
</xsl:variable> |
| 535 |
<xsl:value-of select="$slevel + 1"/> |
| 536 |
</xsl:when> |
| 537 |
<xsl:otherwise>1</xsl:otherwise> |
| 538 |
</xsl:choose> |
| 539 |
</xsl:variable> |
| 540 |
|
| 541 |
<!-- HTML H level is one higher than section level --> |
| 542 |
<xsl:variable name="hlevel"> |
| 543 |
<xsl:choose> |
| 544 |
<xsl:when test="@renderas = 'sect1'">2</xsl:when> |
| 545 |
<xsl:when test="@renderas = 'sect2'">3</xsl:when> |
| 546 |
<xsl:when test="@renderas = 'sect3'">4</xsl:when> |
| 547 |
<xsl:when test="@renderas = 'sect4'">5</xsl:when> |
| 548 |
<xsl:when test="@renderas = 'sect5'">6</xsl:when> |
| 549 |
<xsl:otherwise> |
| 550 |
<xsl:value-of select="$clevel + 1"/> |
| 551 |
</xsl:otherwise> |
| 552 |
</xsl:choose> |
| 553 |
</xsl:variable> |
| 554 |
|
| 555 |
<xsl:element name="h{$hlevel}"> |
| 556 |
<xsl:call-template name="anchor"> |
| 557 |
<xsl:with-param name="conditional" select="0"/> |
| 558 |
</xsl:call-template> |
| 559 |
<xsl:apply-templates/> |
| 560 |
</xsl:element> |
| 561 |
</xsl:template> |
| 562 |
|
| 563 |
<xsl:template match="section/subtitle" mode="titlepage.mode" priority="2"> |
| 564 |
<xsl:call-template name="section.subtitle"/> |
| 565 |
</xsl:template> |
| 566 |
|
| 567 |
<xsl:template match="simplesect/subtitle" mode="titlepage.mode" priority="2"> |
| 568 |
<xsl:call-template name="section.subtitle"/> |
| 569 |
</xsl:template> |
| 570 |
|
| 571 |
<xsl:template match="sect1/subtitle" mode="titlepage.mode" priority="2"> |
| 572 |
<xsl:call-template name="section.subtitle"/> |
| 573 |
</xsl:template> |
| 574 |
|
| 575 |
<xsl:template match="sect2/subtitle" mode="titlepage.mode" priority="2"> |
| 576 |
<xsl:call-template name="section.subtitle"/> |
| 577 |
</xsl:template> |
| 578 |
|
| 579 |
<xsl:template match="sect3/subtitle" mode="titlepage.mode" priority="2"> |
| 580 |
<xsl:call-template name="section.subtitle"/> |
| 581 |
</xsl:template> |
| 582 |
|
| 583 |
<xsl:template match="sect4/subtitle" mode="titlepage.mode" priority="2"> |
| 584 |
<xsl:call-template name="section.subtitle"/> |
| 585 |
</xsl:template> |
| 586 |
|
| 587 |
<xsl:template match="sect5/subtitle" mode="titlepage.mode" priority="2"> |
| 588 |
<xsl:call-template name="section.subtitle"/> |
| 589 |
</xsl:template> |
| 590 |
|
| 591 |
<xsl:template name="section.subtitle"> |
| 592 |
<!-- the context node should be the subtitle of a section when called --> |
| 593 |
<xsl:variable name="section" select="(ancestor::section |
| 594 |
|ancestor::simplesect |
| 595 |
|ancestor::sect1 |
| 596 |
|ancestor::sect2 |
| 597 |
|ancestor::sect3 |
| 598 |
|ancestor::sect4 |
| 599 |
|ancestor::sect5)[last()]"/> |
| 600 |
|
| 601 |
<xsl:variable name="level"> |
| 602 |
<xsl:call-template name="section.level"> |
| 603 |
<xsl:with-param name="node" select="$section"/> |
| 604 |
</xsl:call-template> |
| 605 |
</xsl:variable> |
| 606 |
|
| 607 |
<xsl:call-template name="section.heading"> |
| 608 |
<xsl:with-param name="section" select=".."/> |
| 609 |
<xsl:with-param name="allow-anchors" select="0"/> |
| 610 |
<!-- subtitle heading level one higher than section level --> |
| 611 |
<xsl:with-param name="level" select="$level + 1"/> |
| 612 |
<xsl:with-param name="class" select="'subtitle'"/> |
| 613 |
<xsl:with-param name="title"> |
| 614 |
<xsl:apply-templates select="$section" mode="object.subtitle.markup"> |
| 615 |
<xsl:with-param name="allow-anchors" select="0"/> |
| 616 |
</xsl:apply-templates> |
| 617 |
</xsl:with-param> |
| 618 |
</xsl:call-template> |
| 619 |
</xsl:template> |
| 620 |
|
| 621 |
</xsl:stylesheet> |
| 622 |
|