1155408Srwatson<?xml version='1.0'?> 2155408Srwatson<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3184488Srwatson version='1.0'> 4155408Srwatson 5155408Srwatson<!-- ******************************************************************** 6155408Srwatson $Id: component.xsl,v 1.27 2005/10/28 12:35:15 nwalsh Exp $ 7155408Srwatson ******************************************************************** 8155408Srwatson 9155408Srwatson This file is part of the XSL DocBook Stylesheet distribution. 10155408Srwatson See ../README or http://nwalsh.com/docbook/xsl/ for copyright 11155408Srwatson and other information. 12155408Srwatson 13155408Srwatson ******************************************************************** --> 14155408Srwatson 15155408Srwatson<!-- ==================================================================== --> 16155408Srwatson 17155408Srwatson<xsl:template name="component.title"> 18155408Srwatson <xsl:param name="node" select="."/> 19155408Srwatson 20155408Srwatson <xsl:variable name="level"> 21155408Srwatson <xsl:choose> 22155408Srwatson <xsl:when test="ancestor::section"> 23155408Srwatson <xsl:value-of select="count(ancestor::section)+1"/> 24155408Srwatson </xsl:when> 25155408Srwatson <xsl:when test="ancestor::sect5">6</xsl:when> 26155408Srwatson <xsl:when test="ancestor::sect4">5</xsl:when> 27155408Srwatson <xsl:when test="ancestor::sect3">4</xsl:when> 28155408Srwatson <xsl:when test="ancestor::sect2">3</xsl:when> 29155408Srwatson <xsl:when test="ancestor::sect1">2</xsl:when> 30178186Srwatson <xsl:otherwise>1</xsl:otherwise> 31178186Srwatson </xsl:choose> 32178186Srwatson </xsl:variable> 33155408Srwatson 34155408Srwatson <!-- Let's handle the case where a component (bibliography, for example) 35155408Srwatson occurs inside a section; will we need parameters for this? --> 36155408Srwatson 37155408Srwatson <xsl:element name="h{$level+1}"> 38155408Srwatson <xsl:attribute name="class">title</xsl:attribute> 39155408Srwatson <xsl:call-template name="anchor"> 40155408Srwatson <xsl:with-param name="node" select="$node"/> 41155408Srwatson <xsl:with-param name="conditional" select="0"/> 42155408Srwatson </xsl:call-template> 43155408Srwatson <xsl:apply-templates select="$node" mode="object.title.markup"> 44155408Srwatson <xsl:with-param name="allow-anchors" select="1"/> 45184488Srwatson </xsl:apply-templates> 46155408Srwatson </xsl:element> 47155408Srwatson</xsl:template> 48155408Srwatson 49155408Srwatson<xsl:template name="component.subtitle"> 50184508Srwatson <xsl:param name="node" select="."/> 51155408Srwatson <xsl:variable name="subtitle" 52155408Srwatson select="($node/docinfo/subtitle 53155408Srwatson |$node/info/subtitle 54155408Srwatson |$node/prefaceinfo/subtitle 55156880Srwatson |$node/chapterinfo/subtitle 56155408Srwatson |$node/appendixinfo/subtitle 57155408Srwatson |$node/articleinfo/subtitle 58155408Srwatson |$node/artheader/subtitle 59155408Srwatson |$node/subtitle)[1]"/> 60155408Srwatson 61155408Srwatson <xsl:if test="$subtitle"> 62159269Srwatson <h3 class="subtitle"> 63159269Srwatson <i> 64155408Srwatson <xsl:apply-templates select="$node" mode="object.subtitle.markup"/> 65155408Srwatson </i> 66155408Srwatson </h3> 67155408Srwatson </xsl:if> 68155408Srwatson</xsl:template> 69155408Srwatson 70155408Srwatson<xsl:template name="component.separator"> 71155408Srwatson</xsl:template> 72174894Swkoszek 73159269Srwatson<!-- ==================================================================== --> 74155408Srwatson 75155408Srwatson<xsl:template match="dedication" mode="dedication"> 76155408Srwatson <xsl:call-template name="id.warning"/> 77155408Srwatson 78156883Srwatson <div class="{name(.)}"> 79156880Srwatson <xsl:call-template name="dir"> 80155408Srwatson <xsl:with-param name="inherit" select="1"/> 81155408Srwatson </xsl:call-template> 82155408Srwatson <xsl:call-template name="language.attribute"/> 83155408Srwatson <xsl:call-template name="dedication.titlepage"/> 84155408Srwatson <xsl:apply-templates/> 85155408Srwatson <xsl:call-template name="process.footnotes"/> 86155408Srwatson </div> 87155408Srwatson</xsl:template> 88155408Srwatson 89155408Srwatson<xsl:template match="dedication/title" mode="titlepage.mode" priority="2"> 90155408Srwatson <xsl:call-template name="component.title"> 91155408Srwatson <xsl:with-param name="node" select="ancestor::dedication[1]"/> 92159269Srwatson </xsl:call-template> 93159269Srwatson</xsl:template> 94159269Srwatson 95159269Srwatson<xsl:template match="dedication/subtitle" mode="titlepage.mode" priority="2"> 96159269Srwatson <xsl:call-template name="component.subtitle"> 97159269Srwatson <xsl:with-param name="node" select="ancestor::dedication[1]"/> 98159269Srwatson </xsl:call-template> 99159269Srwatson</xsl:template> 100159269Srwatson 101159269Srwatson<xsl:template match="dedication"></xsl:template> <!-- see mode="dedication" --> 102159269Srwatson<xsl:template match="dedication/title"></xsl:template> 103159269Srwatson<xsl:template match="dedication/subtitle"></xsl:template> 104159269Srwatson<xsl:template match="dedication/titleabbrev"></xsl:template> 105159269Srwatson 106159269Srwatson<!-- ==================================================================== --> 107159269Srwatson 108159269Srwatson<xsl:template match="colophon"> 109155408Srwatson <xsl:call-template name="id.warning"/> 110155408Srwatson 111155408Srwatson <div class="{name(.)}"> 112155408Srwatson <xsl:call-template name="dir"> 113155408Srwatson <xsl:with-param name="inherit" select="1"/> 114155408Srwatson </xsl:call-template> 115155408Srwatson <xsl:call-template name="language.attribute"/> 116155408Srwatson <xsl:if test="$generate.id.attributes != 0"> 117155408Srwatson <xsl:attribute name="id"> 118155408Srwatson <xsl:call-template name="object.id"/> 119155408Srwatson </xsl:attribute> 120155408Srwatson </xsl:if> 121184488Srwatson 122184488Srwatson <xsl:call-template name="component.separator"/> 123184488Srwatson <xsl:call-template name="component.title"/> 124184508Srwatson <xsl:call-template name="component.subtitle"/> 125184488Srwatson 126184488Srwatson <xsl:apply-templates/> 127184508Srwatson <xsl:call-template name="process.footnotes"/> 128184508Srwatson </div> 129184508Srwatson</xsl:template> 130184508Srwatson 131184508Srwatson<xsl:template match="colophon/title"></xsl:template> 132184508Srwatson<xsl:template match="colophon/subtitle"></xsl:template> 133184508Srwatson<xsl:template match="colophon/titleabbrev"></xsl:template> 134184508Srwatson 135184488Srwatson<!-- ==================================================================== --> 136184488Srwatson 137184488Srwatson<xsl:template match="preface"> 138184488Srwatson <xsl:call-template name="id.warning"/> 139184488Srwatson 140184536Srwatson <div class="{name(.)}"> 141184536Srwatson <xsl:call-template name="dir"> 142184536Srwatson <xsl:with-param name="inherit" select="1"/> 143184536Srwatson </xsl:call-template> 144184536Srwatson <xsl:call-template name="language.attribute"/> 145184536Srwatson <xsl:if test="$generate.id.attributes != 0"> 146184536Srwatson <xsl:attribute name="id"> 147155408Srwatson <xsl:call-template name="object.id"/> 148155408Srwatson </xsl:attribute> 149184536Srwatson </xsl:if> 150184536Srwatson 151155408Srwatson <xsl:call-template name="component.separator"/> 152184540Srwatson <xsl:call-template name="preface.titlepage"/> 153184540Srwatson 154184540Srwatson <xsl:variable name="toc.params"> 155155408Srwatson <xsl:call-template name="find.path.params"> 156155408Srwatson <xsl:with-param name="table" select="normalize-space($generate.toc)"/> 157155408Srwatson </xsl:call-template> 158155408Srwatson </xsl:variable> 159159269Srwatson 160159269Srwatson <xsl:if test="contains($toc.params, 'toc')"> 161159269Srwatson <xsl:call-template name="component.toc"> 162159269Srwatson <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> 163159269Srwatson </xsl:call-template> 164159269Srwatson <xsl:call-template name="component.toc.separator"/> 165159269Srwatson </xsl:if> 166159269Srwatson <xsl:apply-templates/> 167159269Srwatson <xsl:call-template name="process.footnotes"/> 168159269Srwatson </div> 169159269Srwatson</xsl:template> 170184508Srwatson 171184508Srwatson<xsl:template match="preface/title" mode="titlepage.mode" priority="2"> 172184508Srwatson <xsl:call-template name="component.title"> 173159269Srwatson <xsl:with-param name="node" select="ancestor::preface[1]"/> 174155408Srwatson </xsl:call-template> 175155408Srwatson</xsl:template> 176159269Srwatson 177159269Srwatson<xsl:template match="preface/subtitle 178159269Srwatson |preface/prefaceinfo/subtitle 179155408Srwatson |preface/info/subtitle 180155408Srwatson |preface/docinfo/subtitle" 181155408Srwatson mode="titlepage.mode" priority="2"> 182184508Srwatson <xsl:call-template name="component.subtitle"> 183184508Srwatson <xsl:with-param name="node" select="ancestor::preface[1]"/> 184184508Srwatson </xsl:call-template> 185184508Srwatson</xsl:template> 186184508Srwatson 187184508Srwatson<xsl:template match="preface/docinfo|prefaceinfo"></xsl:template> 188184508Srwatson<xsl:template match="preface/title"></xsl:template> 189184488Srwatson<xsl:template match="preface/titleabbrev"></xsl:template> 190184508Srwatson<xsl:template match="preface/subtitle"></xsl:template> 191184508Srwatson 192184508Srwatson<!-- ==================================================================== --> 193184508Srwatson 194184508Srwatson<xsl:template match="chapter"> 195184508Srwatson <xsl:call-template name="id.warning"/> 196155408Srwatson 197184488Srwatson <div class="{name(.)}"> 198184488Srwatson <xsl:call-template name="dir"> 199184488Srwatson <xsl:with-param name="inherit" select="1"/> 200184488Srwatson </xsl:call-template> 201155408Srwatson <xsl:call-template name="language.attribute"/> 202155408Srwatson <xsl:if test="$generate.id.attributes != 0"> 203184488Srwatson <xsl:attribute name="id"> 204155408Srwatson <xsl:call-template name="object.id"/> 205184488Srwatson </xsl:attribute> 206184488Srwatson </xsl:if> 207184488Srwatson 208184488Srwatson <xsl:call-template name="component.separator"/> 209184488Srwatson <xsl:call-template name="chapter.titlepage"/> 210184488Srwatson 211184488Srwatson <xsl:variable name="toc.params"> 212184488Srwatson <xsl:call-template name="find.path.params"> 213155408Srwatson <xsl:with-param name="table" select="normalize-space($generate.toc)"/> 214155408Srwatson </xsl:call-template> 215155408Srwatson </xsl:variable> 216155408Srwatson <xsl:if test="contains($toc.params, 'toc')"> 217155408Srwatson <xsl:call-template name="component.toc"> 218155408Srwatson <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> 219155408Srwatson </xsl:call-template> 220155408Srwatson <xsl:call-template name="component.toc.separator"/> 221155408Srwatson </xsl:if> 222155408Srwatson <xsl:apply-templates/> 223155408Srwatson <xsl:call-template name="process.footnotes"/> 224155408Srwatson </div> 225155408Srwatson</xsl:template> 226155408Srwatson 227155408Srwatson<xsl:template match="chapter/title" mode="titlepage.mode" priority="2"> 228155408Srwatson <xsl:call-template name="component.title"> 229161582Srwatson <xsl:with-param name="node" select="ancestor::chapter[1]"/> 230155408Srwatson </xsl:call-template> 231155408Srwatson</xsl:template> 232155408Srwatson 233179726Sed<xsl:template match="chapter/subtitle 234155408Srwatson |chapter/chapterinfo/subtitle 235155408Srwatson |chapter/info/subtitle 236155408Srwatson |chapter/docinfo/subtitle" 237155408Srwatson mode="titlepage.mode" priority="2"> 238155408Srwatson <xsl:call-template name="component.subtitle"> 239161582Srwatson <xsl:with-param name="node" select="ancestor::chapter[1]"/> 240155408Srwatson </xsl:call-template> 241155408Srwatson</xsl:template> 242155408Srwatson 243161582Srwatson<xsl:template match="chapter/docinfo|chapterinfo"></xsl:template> 244161582Srwatson<xsl:template match="chapter/title"></xsl:template> 245161582Srwatson<xsl:template match="chapter/titleabbrev"></xsl:template> 246161582Srwatson<xsl:template match="chapter/subtitle"></xsl:template> 247161582Srwatson 248161582Srwatson<!-- ==================================================================== --> 249161582Srwatson 250161582Srwatson<xsl:template match="appendix"> 251161582Srwatson <xsl:variable name="ischunk"> 252161582Srwatson <xsl:call-template name="chunk"/> 253155408Srwatson </xsl:variable> 254155408Srwatson 255155408Srwatson <xsl:call-template name="id.warning"/> 256155408Srwatson 257155408Srwatson <div class="{name(.)}"> 258155408Srwatson <xsl:call-template name="dir"> 259155408Srwatson <xsl:with-param name="inherit" select="1"/> 260155408Srwatson </xsl:call-template> 261155408Srwatson <xsl:call-template name="language.attribute"/> 262155408Srwatson <xsl:if test="$generate.id.attributes != 0"> 263155408Srwatson <xsl:attribute name="id"> 264155408Srwatson <xsl:call-template name="object.id"/> 265155408Srwatson </xsl:attribute> 266155408Srwatson </xsl:if> 267155408Srwatson 268155408Srwatson <xsl:choose> 269155408Srwatson <xsl:when test="parent::article and $ischunk = 0"> 270155408Srwatson <xsl:call-template name="section.heading"> 271155408Srwatson <xsl:with-param name="level" select="1"/> 272155408Srwatson <xsl:with-param name="title"> 273159269Srwatson <xsl:apply-templates select="." mode="object.title.markup"/> 274159269Srwatson </xsl:with-param> 275159269Srwatson </xsl:call-template> 276159269Srwatson </xsl:when> 277159269Srwatson <xsl:otherwise> 278159269Srwatson <xsl:call-template name="component.separator"/> 279159269Srwatson <xsl:call-template name="appendix.titlepage"/> 280184488Srwatson </xsl:otherwise> 281159269Srwatson </xsl:choose> 282159269Srwatson 283159269Srwatson <xsl:variable name="toc.params"> 284159269Srwatson <xsl:call-template name="find.path.params"> 285159269Srwatson <xsl:with-param name="table" select="normalize-space($generate.toc)"/> 286159269Srwatson </xsl:call-template> 287159269Srwatson </xsl:variable> 288159269Srwatson 289159269Srwatson <xsl:if test="contains($toc.params, 'toc')"> 290159269Srwatson <xsl:call-template name="component.toc"> 291159269Srwatson <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> 292159269Srwatson </xsl:call-template> 293159269Srwatson <xsl:call-template name="component.toc.separator"/> 294159269Srwatson </xsl:if> 295159269Srwatson 296159269Srwatson <xsl:apply-templates/> 297159269Srwatson 298159269Srwatson <xsl:if test="not(parent::article) or $ischunk != 0"> 299184488Srwatson <xsl:call-template name="process.footnotes"/> 300159269Srwatson </xsl:if> 301159269Srwatson </div> 302159269Srwatson</xsl:template> 303159269Srwatson 304159269Srwatson<xsl:template match="appendix/title" mode="titlepage.mode" priority="2"> 305159269Srwatson <xsl:call-template name="component.title"> 306184488Srwatson <xsl:with-param name="node" select="ancestor::appendix[1]"/> 307159269Srwatson </xsl:call-template> 308159269Srwatson</xsl:template> 309159269Srwatson 310159269Srwatson<xsl:template match="appendix/subtitle 311159269Srwatson |appendix/appendixinfo/subtitle 312159269Srwatson |appendix/info/subtitle 313159269Srwatson |appendix/docinfo/subtitle" 314159269Srwatson mode="titlepage.mode" priority="2"> 315159269Srwatson <xsl:call-template name="component.subtitle"> 316159269Srwatson <xsl:with-param name="node" select="ancestor::appendix[1]"/> 317159269Srwatson </xsl:call-template> 318159269Srwatson</xsl:template> 319159269Srwatson 320159269Srwatson<xsl:template match="appendix/docinfo|appendixinfo"></xsl:template> 321159269Srwatson<xsl:template match="appendix/title"></xsl:template> 322159269Srwatson<xsl:template match="appendix/titleabbrev"></xsl:template> 323159269Srwatson<xsl:template match="appendix/subtitle"></xsl:template> 324184488Srwatson 325159269Srwatson<!-- ==================================================================== --> 326159269Srwatson 327159269Srwatson<xsl:template match="article"> 328159269Srwatson <xsl:call-template name="id.warning"/> 329159269Srwatson 330159269Srwatson <div class="{name(.)}"> 331159269Srwatson <xsl:call-template name="dir"> 332159269Srwatson <xsl:with-param name="inherit" select="1"/> 333184488Srwatson </xsl:call-template> 334159269Srwatson <xsl:call-template name="language.attribute"/> 335159269Srwatson <xsl:if test="$generate.id.attributes != 0"> 336159269Srwatson <xsl:attribute name="id"> 337159269Srwatson <xsl:call-template name="object.id"/> 338159269Srwatson </xsl:attribute> 339159269Srwatson </xsl:if> 340159269Srwatson 341159269Srwatson <xsl:call-template name="article.titlepage"/> 342159269Srwatson 343159269Srwatson <xsl:variable name="toc.params"> 344159269Srwatson <xsl:call-template name="find.path.params"> 345159269Srwatson <xsl:with-param name="table" select="normalize-space($generate.toc)"/> 346159269Srwatson </xsl:call-template> 347184488Srwatson </xsl:variable> 348159269Srwatson 349159269Srwatson <xsl:call-template name="make.lots"> 350159269Srwatson <xsl:with-param name="toc.params" select="$toc.params"/> 351159269Srwatson <xsl:with-param name="toc"> 352159269Srwatson <xsl:call-template name="component.toc"> 353159269Srwatson <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/> 354184488Srwatson </xsl:call-template> 355159269Srwatson </xsl:with-param> 356159269Srwatson </xsl:call-template> 357159269Srwatson 358159269Srwatson <xsl:apply-templates/> 359159269Srwatson <xsl:call-template name="process.footnotes"/> 360159269Srwatson </div> 361159269Srwatson</xsl:template> 362159269Srwatson 363159269Srwatson<xsl:template match="article/title" mode="titlepage.mode" priority="2"> 364159269Srwatson <xsl:call-template name="component.title"> 365159269Srwatson <xsl:with-param name="node" select="ancestor::article[1]"/> 366159269Srwatson </xsl:call-template> 367159269Srwatson</xsl:template> 368184488Srwatson 369159269Srwatson<xsl:template match="article/subtitle 370159269Srwatson |article/articleinfo/subtitle 371159269Srwatson |article/info/subtitle 372159269Srwatson |article/artheader/subtitle" 373159269Srwatson mode="titlepage.mode" priority="2"> 374159269Srwatson <xsl:call-template name="component.subtitle"> 375159269Srwatson <xsl:with-param name="node" select="ancestor::article[1]"/> 376159269Srwatson </xsl:call-template> 377159269Srwatson</xsl:template> 378159269Srwatson 379159269Srwatson<xsl:template match="article/artheader|article/articleinfo"></xsl:template> 380184488Srwatson<xsl:template match="article/title"></xsl:template> 381159269Srwatson<xsl:template match="article/titleabbrev"></xsl:template> 382184488Srwatson<xsl:template match="article/subtitle"></xsl:template> 383159269Srwatson 384159269Srwatson<!-- ==================================================================== --> 385170196Srwatson 386159269Srwatson</xsl:stylesheet> 387159269Srwatson 388159269Srwatson