This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] Change class attribute for titles based on value
- From: David Pratt <prattda at assiniboine dot net>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Fri, 9 May 2003 15:23:03 -0500
- Subject: [docbook-apps] Change class attribute for titles based on value
I want to change the value of the class attribute for sect2 titles
based on the value of the title
so that I have finer control over CSS (style same level headers
differently).
I have located the following templates in the titlepage.templates.xsl
in the xhtml directory. I am chunking my output
and using version 1.61.0. sect2.titlepage.recto holds the output value
that is currently being displayed (including the numbering it appears
that I have turned on)
So I am having difficulty with what to compare. For example I want to
compare the title value against terms like summary, introduction etc.
so that the resulting div tag will be <div
xmlns="http://www.w3.org/1999/xhtml" class="summary"> when title value
equals summary, <div xmlns="http://www.w3.org/1999/xhtml"
class="introduction"> when title value equals introduction, and so on.
It is a bit complicated with the modes as well to determine
what to do. Help appreciated.
<xsl:template name="sect2.titlepage.recto">
<xsl:choose>
<xsl:when test="sect2info/title">
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/title"/>
</xsl:when>
<xsl:when test="title">
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="title"/>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="sect2info/subtitle">
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/subtitle"/>
</xsl:when>
<xsl:when test="subtitle">
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="subtitle"/>
</xsl:when>
</xsl:choose>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/corpauthor"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/authorgroup"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/author"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/othercredit"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/releaseinfo"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/copyright"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/legalnotice"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/pubdate"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/revision"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/revhistory"/>
<xsl:apply-templates mode="sect2.titlepage.recto.auto.mode"
select="sect2info/abstract"/>
</xsl:template>
<xsl:template name="sect2.titlepage">
<div xmlns="http://www.w3.org/1999/xhtml" class="titlepage"> <--
this is the class attribute I want to change
<div>
<xsl:call-template name="sect2.titlepage.before.recto"/>
<xsl:call-template name="sect2.titlepage.recto"/>
<-- this parameter that holds the current title value
</div>
<-- <div>
<xsl:call-template name="sect2.titlepage.before.verso"/>
<-- commented out to suppress extra div tag in html output
<xsl:call-template name="sect2.titlepage.verso"/>
</div> -->
<xsl:call-template name="sect2.titlepage.separator"/>
</div>
</xsl:template>
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org