| 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: component.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 name="component.title"> |
| 18 |
<xsl:param name="node" select="."/> |
| 19 |
|
| 20 |
<xsl:variable name="level"> |
| 21 |
<xsl:choose> |
| 22 |
<xsl:when test="ancestor::section"> |
| 23 |
<xsl:value-of select="count(ancestor::section)+1"/> |
| 24 |
</xsl:when> |
| 25 |
<xsl:when test="ancestor::sect5">6</xsl:when> |
| 26 |
<xsl:when test="ancestor::sect4">5</xsl:when> |
| 27 |
<xsl:when test="ancestor::sect3">4</xsl:when> |
| 28 |
<xsl:when test="ancestor::sect2">3</xsl:when> |
| 29 |
<xsl:when test="ancestor::sect1">2</xsl:when> |
| 30 |
<xsl:otherwise>1</xsl:otherwise> |
| 31 |
</xsl:choose> |
| 32 |
</xsl:variable> |
| 33 |
|
| 34 |
<!-- Let's handle the case where a component (bibliography, for example) |
| 35 |
occurs inside a section; will we need parameters for this? --> |
| 36 |
|
| 37 |
<xsl:element name="h{$level+1}"> |
| 38 |
<xsl:attribute name="class">title</xsl:attribute> |
| 39 |
<xsl:if test="$generate.id.attributes = 0"> |
| 40 |
<xsl:call-template name="anchor"> |
| 41 |
<xsl:with-param name="node" select="$node"/> |
| 42 |
<xsl:with-param name="conditional" select="0"/> |
| 43 |
</xsl:call-template> |
| 44 |
</xsl:if> |
| 45 |
<xsl:apply-templates select="$node" mode="object.title.markup"> |
| 46 |
<xsl:with-param name="allow-anchors" select="1"/> |
| 47 |
</xsl:apply-templates> |
| 48 |
</xsl:element> |
| 49 |
</xsl:template> |
| 50 |
|
| 51 |
<xsl:template name="component.subtitle"> |
| 52 |
<xsl:param name="node" select="."/> |
| 53 |
<xsl:variable name="subtitle" |
| 54 |
select="($node/docinfo/subtitle |
| 55 |
|$node/info/subtitle |
| 56 |
|$node/prefaceinfo/subtitle |
| 57 |
|$node/chapterinfo/subtitle |
| 58 |
|$node/appendixinfo/subtitle |
| 59 |
|$node/articleinfo/subtitle |
| 60 |
|$node/artheader/subtitle |
| 61 |
|$node/subtitle)[1]"/> |
| 62 |
|
| 63 |
<xsl:if test="$subtitle"> |
| 64 |
<h3 class="subtitle"> |
| 65 |
<i> |
| 66 |
<xsl:apply-templates select="$node" mode="object.subtitle.markup"/> |
| 67 |
</i> |
| 68 |
</h3> |
| 69 |
</xsl:if> |
| 70 |
</xsl:template> |
| 71 |
|
| 72 |
<xsl:template name="component.separator"> |
| 73 |
</xsl:template> |
| 74 |
|
| 75 |
<!-- ==================================================================== --> |
| 76 |
|
| 77 |
<xsl:template match="dedication" mode="dedication"> |
| 78 |
<xsl:call-template name="id.warning"/> |
| 79 |
|
| 80 |
<div> |
| 81 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 82 |
<xsl:call-template name="dir"> |
| 83 |
<xsl:with-param name="inherit" select="1"/> |
| 84 |
</xsl:call-template> |
| 85 |
<xsl:call-template name="language.attribute"/> |
| 86 |
<xsl:call-template name="dedication.titlepage"/> |
| 87 |
<xsl:apply-templates/> |
| 88 |
<xsl:call-template name="process.footnotes"/> |
| 89 |
</div> |
| 90 |
</xsl:template> |
| 91 |
|
| 92 |
<xsl:template match="dedication/title|dedication/info/title" |
| 93 |
mode="titlepage.mode" priority="2"> |
| 94 |
<xsl:call-template name="component.title"> |
| 95 |
<xsl:with-param name="node" select="ancestor::dedication[1]"/> |
| 96 |
</xsl:call-template> |
| 97 |
</xsl:template> |
| 98 |
|
| 99 |
<xsl:template match="dedication/subtitle|dedication/info/subtitle" |
| 100 |
mode="titlepage.mode" priority="2"> |
| 101 |
<xsl:call-template name="component.subtitle"> |
| 102 |
<xsl:with-param name="node" select="ancestor::dedication[1]"/> |
| 103 |
</xsl:call-template> |
| 104 |
</xsl:template> |
| 105 |
|
| 106 |
<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" --> |
| 107 |
<xsl:template match="dedication/title"></xsl:template> |
| 108 |
<xsl:template match="dedication/subtitle"></xsl:template> |
| 109 |
<xsl:template match="dedication/titleabbrev"></xsl:template> |
| 110 |
|
| 111 |
<!-- ==================================================================== --> |
| 112 |
|
| 113 |
<xsl:template match="colophon"> |
| 114 |
<xsl:call-template name="id.warning"/> |
| 115 |
|
| 116 |
<div> |
| 117 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 118 |
<xsl:call-template name="dir"> |
| 119 |
<xsl:with-param name="inherit" select="1"/> |
| 120 |
</xsl:call-template> |
| 121 |
<xsl:call-template name="language.attribute"/> |
| 122 |
<xsl:if test="$generate.id.attributes != 0"> |
| 123 |
<xsl:attribute name="id"> |
| 124 |
<xsl:call-template name="object.id"/> |
| 125 |
</xsl:attribute> |
| 126 |
</xsl:if> |
| 127 |
|
| 128 |
<xsl:call-template name="component.separator"/> |
| 129 |
<xsl:call-template name="component.title"/> |
| 130 |
<xsl:call-template name="component.subtitle"/> |
| 131 |
|
| 132 |
<xsl:apply-templates/> |
| 133 |
<xsl:call-template name="process.footnotes"/> |
| 134 |
</div> |
| 135 |
</xsl:template> |
| 136 |
|
| 137 |
<xsl:template match="colophon/title"></xsl:template> |
| 138 |
<xsl:template match="colophon/subtitle"></xsl:template> |
| 139 |
<xsl:template match="colophon/titleabbrev"></xsl:template> |
| 140 |
|
| 141 |
<!-- ==================================================================== --> |
| 142 |
|
| 143 |
<xsl:template match="preface"> |
| 144 |
<xsl:call-template name="id.warning"/> |
| 145 |
|
| 146 |
<div> |
| 147 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 148 |
<xsl:call-template name="dir"> |
| 149 |
<xsl:with-param name="inherit" select="1"/> |
| 150 |
</xsl:call-template> |
| 151 |
<xsl:call-template name="language.attribute"/> |
| 152 |
<xsl:if test="$generate.id.attributes != 0"> |
| 153 |
<xsl:attribute name="id"> |
| 154 |
<xsl:call-template name="object.id"/> |
| 155 |
</xsl:attribute> |
| 156 |
</xsl:if> |
| 157 |
|
| 158 |
<xsl:call-template name="component.separator"/> |
| 159 |
<xsl:call-template name="preface.titlepage"/> |
| 160 |
|
| 161 |
<xsl:variable name="toc.params"> |
| 162 |
<xsl:call-template name="find.path.params"> |
| 163 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 164 |
</xsl:call-template> |
| 165 |
</xsl:variable> |
| 166 |
|
| 167 |
<xsl:if test="contains($toc.params, 'toc')"> |
| 168 |
<xsl:call-template name="component.toc"> |
| 169 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 170 |
</xsl:call-template> |
| 171 |
<xsl:call-template name="component.toc.separator"/> |
| 172 |
</xsl:if> |
| 173 |
<xsl:apply-templates/> |
| 174 |
<xsl:call-template name="process.footnotes"/> |
| 175 |
</div> |
| 176 |
</xsl:template> |
| 177 |
|
| 178 |
<xsl:template match="preface/title" mode="titlepage.mode" priority="2"> |
| 179 |
<xsl:call-template name="component.title"> |
| 180 |
<xsl:with-param name="node" select="ancestor::preface[1]"/> |
| 181 |
</xsl:call-template> |
| 182 |
</xsl:template> |
| 183 |
|
| 184 |
<xsl:template match="preface/subtitle |
| 185 |
|preface/prefaceinfo/subtitle |
| 186 |
|preface/info/subtitle |
| 187 |
|preface/docinfo/subtitle" |
| 188 |
mode="titlepage.mode" priority="2"> |
| 189 |
<xsl:call-template name="component.subtitle"> |
| 190 |
<xsl:with-param name="node" select="ancestor::preface[1]"/> |
| 191 |
</xsl:call-template> |
| 192 |
</xsl:template> |
| 193 |
|
| 194 |
<xsl:template match="preface/docinfo|prefaceinfo"></xsl:template> |
| 195 |
<xsl:template match="preface/info"></xsl:template> |
| 196 |
<xsl:template match="preface/title"></xsl:template> |
| 197 |
<xsl:template match="preface/titleabbrev"></xsl:template> |
| 198 |
<xsl:template match="preface/subtitle"></xsl:template> |
| 199 |
|
| 200 |
<!-- ==================================================================== --> |
| 201 |
|
| 202 |
<xsl:template match="chapter"> |
| 203 |
<xsl:call-template name="id.warning"/> |
| 204 |
|
| 205 |
<div> |
| 206 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 207 |
<xsl:call-template name="dir"> |
| 208 |
<xsl:with-param name="inherit" select="1"/> |
| 209 |
</xsl:call-template> |
| 210 |
<xsl:call-template name="language.attribute"/> |
| 211 |
<xsl:if test="$generate.id.attributes != 0"> |
| 212 |
<xsl:attribute name="id"> |
| 213 |
<xsl:call-template name="object.id"/> |
| 214 |
</xsl:attribute> |
| 215 |
</xsl:if> |
| 216 |
|
| 217 |
<xsl:call-template name="component.separator"/> |
| 218 |
<xsl:call-template name="chapter.titlepage"/> |
| 219 |
|
| 220 |
<xsl:variable name="toc.params"> |
| 221 |
<xsl:call-template name="find.path.params"> |
| 222 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 223 |
</xsl:call-template> |
| 224 |
</xsl:variable> |
| 225 |
<xsl:if test="contains($toc.params, 'toc')"> |
| 226 |
<xsl:call-template name="component.toc"> |
| 227 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 228 |
</xsl:call-template> |
| 229 |
<xsl:call-template name="component.toc.separator"/> |
| 230 |
</xsl:if> |
| 231 |
<xsl:apply-templates/> |
| 232 |
<xsl:call-template name="process.footnotes"/> |
| 233 |
</div> |
| 234 |
</xsl:template> |
| 235 |
|
| 236 |
<xsl:template match="chapter/title" mode="titlepage.mode" priority="2"> |
| 237 |
<xsl:call-template name="component.title"> |
| 238 |
<xsl:with-param name="node" select="ancestor::chapter[1]"/> |
| 239 |
</xsl:call-template> |
| 240 |
</xsl:template> |
| 241 |
|
| 242 |
<xsl:template match="chapter/subtitle |
| 243 |
|chapter/chapterinfo/subtitle |
| 244 |
|chapter/info/subtitle |
| 245 |
|chapter/docinfo/subtitle" |
| 246 |
mode="titlepage.mode" priority="2"> |
| 247 |
<xsl:call-template name="component.subtitle"> |
| 248 |
<xsl:with-param name="node" select="ancestor::chapter[1]"/> |
| 249 |
</xsl:call-template> |
| 250 |
</xsl:template> |
| 251 |
|
| 252 |
<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template> |
| 253 |
<xsl:template match="chapter/info"></xsl:template> |
| 254 |
<xsl:template match="chapter/title"></xsl:template> |
| 255 |
<xsl:template match="chapter/titleabbrev"></xsl:template> |
| 256 |
<xsl:template match="chapter/subtitle"></xsl:template> |
| 257 |
|
| 258 |
<!-- ==================================================================== --> |
| 259 |
|
| 260 |
<xsl:template match="appendix"> |
| 261 |
<xsl:variable name="ischunk"> |
| 262 |
<xsl:call-template name="chunk"/> |
| 263 |
</xsl:variable> |
| 264 |
|
| 265 |
<xsl:call-template name="id.warning"/> |
| 266 |
|
| 267 |
<div> |
| 268 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 269 |
<xsl:call-template name="dir"> |
| 270 |
<xsl:with-param name="inherit" select="1"/> |
| 271 |
</xsl:call-template> |
| 272 |
<xsl:call-template name="language.attribute"/> |
| 273 |
<xsl:if test="$generate.id.attributes != 0"> |
| 274 |
<xsl:attribute name="id"> |
| 275 |
<xsl:call-template name="object.id"/> |
| 276 |
</xsl:attribute> |
| 277 |
</xsl:if> |
| 278 |
|
| 279 |
<xsl:choose> |
| 280 |
<xsl:when test="parent::article and $ischunk = 0"> |
| 281 |
<xsl:call-template name="section.heading"> |
| 282 |
<xsl:with-param name="level" select="1"/> |
| 283 |
<xsl:with-param name="title"> |
| 284 |
<xsl:apply-templates select="." mode="object.title.markup"/> |
| 285 |
</xsl:with-param> |
| 286 |
</xsl:call-template> |
| 287 |
</xsl:when> |
| 288 |
<xsl:otherwise> |
| 289 |
<xsl:call-template name="component.separator"/> |
| 290 |
<xsl:call-template name="appendix.titlepage"/> |
| 291 |
</xsl:otherwise> |
| 292 |
</xsl:choose> |
| 293 |
|
| 294 |
<xsl:variable name="toc.params"> |
| 295 |
<xsl:call-template name="find.path.params"> |
| 296 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 297 |
</xsl:call-template> |
| 298 |
</xsl:variable> |
| 299 |
|
| 300 |
<xsl:if test="contains($toc.params, 'toc')"> |
| 301 |
<xsl:call-template name="component.toc"> |
| 302 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 303 |
</xsl:call-template> |
| 304 |
<xsl:call-template name="component.toc.separator"/> |
| 305 |
</xsl:if> |
| 306 |
|
| 307 |
<xsl:apply-templates/> |
| 308 |
|
| 309 |
<xsl:if test="not(parent::article) or $ischunk != 0"> |
| 310 |
<xsl:call-template name="process.footnotes"/> |
| 311 |
</xsl:if> |
| 312 |
</div> |
| 313 |
</xsl:template> |
| 314 |
|
| 315 |
<xsl:template match="appendix/title" mode="titlepage.mode" priority="2"> |
| 316 |
<xsl:call-template name="component.title"> |
| 317 |
<xsl:with-param name="node" select="ancestor::appendix[1]"/> |
| 318 |
</xsl:call-template> |
| 319 |
</xsl:template> |
| 320 |
|
| 321 |
<xsl:template match="appendix/subtitle |
| 322 |
|appendix/appendixinfo/subtitle |
| 323 |
|appendix/info/subtitle |
| 324 |
|appendix/docinfo/subtitle" |
| 325 |
mode="titlepage.mode" priority="2"> |
| 326 |
<xsl:call-template name="component.subtitle"> |
| 327 |
<xsl:with-param name="node" select="ancestor::appendix[1]"/> |
| 328 |
</xsl:call-template> |
| 329 |
</xsl:template> |
| 330 |
|
| 331 |
<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template> |
| 332 |
<xsl:template match="appendix/info"></xsl:template> |
| 333 |
<xsl:template match="appendix/title"></xsl:template> |
| 334 |
<xsl:template match="appendix/titleabbrev"></xsl:template> |
| 335 |
<xsl:template match="appendix/subtitle"></xsl:template> |
| 336 |
|
| 337 |
<!-- ==================================================================== --> |
| 338 |
|
| 339 |
<xsl:template match="article"> |
| 340 |
<xsl:call-template name="id.warning"/> |
| 341 |
|
| 342 |
<div> |
| 343 |
<xsl:apply-templates select="." mode="class.attribute"/> |
| 344 |
<xsl:call-template name="dir"> |
| 345 |
<xsl:with-param name="inherit" select="1"/> |
| 346 |
</xsl:call-template> |
| 347 |
<xsl:call-template name="language.attribute"/> |
| 348 |
<xsl:if test="$generate.id.attributes != 0"> |
| 349 |
<xsl:attribute name="id"> |
| 350 |
<xsl:call-template name="object.id"/> |
| 351 |
</xsl:attribute> |
| 352 |
</xsl:if> |
| 353 |
|
| 354 |
<xsl:call-template name="article.titlepage"/> |
| 355 |
|
| 356 |
<xsl:variable name="toc.params"> |
| 357 |
<xsl:call-template name="find.path.params"> |
| 358 |
<xsl:with-param name="table" select="normalize-space($generate.toc)"/> |
| 359 |
</xsl:call-template> |
| 360 |
</xsl:variable> |
| 361 |
|
| 362 |
<xsl:call-template name="make.lots"> |
| 363 |
<xsl:with-param name="toc.params" select="$toc.params"/> |
| 364 |
<xsl:with-param name="toc"> |
| 365 |
<xsl:call-template name="component.toc"> |
| 366 |
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> |
| 367 |
</xsl:call-template> |
| 368 |
</xsl:with-param> |
| 369 |
</xsl:call-template> |
| 370 |
|
| 371 |
<xsl:apply-templates/> |
| 372 |
<xsl:call-template name="process.footnotes"/> |
| 373 |
</div> |
| 374 |
</xsl:template> |
| 375 |
|
| 376 |
<xsl:template match="article/title|article/articleinfo/title" mode="titlepage.mode" priority="2"> |
| 377 |
<xsl:call-template name="component.title"> |
| 378 |
<xsl:with-param name="node" select="ancestor::article[1]"/> |
| 379 |
</xsl:call-template> |
| 380 |
</xsl:template> |
| 381 |
|
| 382 |
<xsl:template match="article/subtitle |
| 383 |
|article/articleinfo/subtitle |
| 384 |
|article/info/subtitle |
| 385 |
|article/artheader/subtitle" |
| 386 |
mode="titlepage.mode" priority="2"> |
| 387 |
<xsl:call-template name="component.subtitle"> |
| 388 |
<xsl:with-param name="node" select="ancestor::article[1]"/> |
| 389 |
</xsl:call-template> |
| 390 |
</xsl:template> |
| 391 |
|
| 392 |
<xsl:template match="article/artheader|article/articleinfo"></xsl:template> |
| 393 |
<xsl:template match="article/info"></xsl:template> |
| 394 |
<xsl:template match="article/title"></xsl:template> |
| 395 |
<xsl:template match="article/titleabbrev"></xsl:template> |
| 396 |
<xsl:template match="article/subtitle"></xsl:template> |
| 397 |
|
| 398 |
<!-- ==================================================================== --> |
| 399 |
|
| 400 |
</xsl:stylesheet> |
| 401 |
|