OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Adding an attribute to the <body> of the TOC file


The chunk-filename returns the chunk filename for the specified element. 
Since the TOC is generated entirely, it is not an element to be matched 
with select=".".  So you get the chunk filename for the book element, which 
is 'index.html'.  The filename for a separate toc is a special case, 
generated inside the template named 'make.lots' in html/chunk-code.xsl.  It 
looks like this:

                <xsl:apply-templates select="." 
mode="recursive-chunk-filename">
                  <xsl:with-param name="recursive" select="true()"/>
                </xsl:apply-templates>
                <xsl:text>-toc</xsl:text>
                <xsl:value-of select="$html.ext"/>

The recursive-chunk-filename template returns the 'bk01' part for the book 
element, then the -toc string is added, and finally the html extension.

But I'm not sure getting this filename will help with customizing the 
body.attributes template for the separate toc chunks.  The body.attributes 
template is called by the chunk-element-content template in 
html/chunk-common.xsl, and while it receives a parameter named nav.context 
which is set to 'toc' by make.lots, it does not pass along that parameter 
to the body.attributes template.  So from within body.attributes, I'm not 
sure how you would choose the condition to select different values for the 
separate chunk files.

I think you would have to customize chunk-element-content to pass along the 
nav.context parameter to body.attributes, and you would have to add that 
parameter to body.attributes so you can test for it.

Normally you could use the current context element in body.attributes (test 
with something like self::chapter) to test for the current context, but the 
generated TOC has the same context as book.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "ileana patrolea" <ileana.patrolea@yahoo.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, October 09, 2006 2:54 AM
Subject: [docbook-apps] Adding an attribute to the <body> of the TOC file


> Hello,
>
> -------------------
> Problem description
> -------------------
> I'm generating the TOC in a separate file whose name
> is generated automatically: bk01-toc.html
> I am trying to add a new attribute to the <body>
> element of this file.
>
> -------------------
> My solution
> -------------------
> I override the body.attributes template.
> In my customized template, I generate the filename of
> the current chunk and test if it contains the 'toc'
> string.
>
> <xsl:variable name="filename">
>            <xsl:apply-templates select="."
> mode="chunk-filename"/>
> </xsl:variable>
> <xsl:message>Testing filename: <xsl:value-of
> select="$filename"/></xsl:message>
>
> <xsl:if test="contains($filename,'toc')">
>            <xsl:attribute
> name="class">test</xsl:attribute>
> </xsl:if>
>
> -------------------
> Troubles
> -------------------
> The result returned in the filename variable is
> index.html and not bk01-toc.html
>
> -------------------
> Questions
> -------------------
> Why is this happening? What template should I use to
> get bk01-toc.html?
>
> Could I use a different approach to solve my problem
> (without generating the filename of the current
> chunk)?
>
> Thank you,
>
>
> ---------------
> mailto: ileana.patrolea@yahoo.com
> tel: +40 724 511 514
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
> 




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]