This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Customization Problem - Chapter TOCs


On Tue, Dec 03, 2002 at 02:32:46PM +0000, Nicholas Atkinson wrote:
> I have a number of customizations which I use when generating HTML Help from my docbook documents.
> 
> However there is one customization which causes problems when I add it to the customization layer, which works fine (in the v 1.56.1 transforms) when I modify html\component.xsl directly.  I would like to resolve this if possible as modifying the transforms themselves is, well, messy!
> 
> Basically I want the chapter toc to appear after the text of the chapter (before any subsections of course) rather than before it.  I already have a customization which gets rid of the "Table of Contents" text.  The desired end result is that links to child sections appear at the bottom of the page rather than the top.
> 
> If I change this template in html\component.xsl:
> 
> <xsl:template match="chapter">
>   <div class="{name(.)}">
>     <xsl:if test="$generate.id.attributes != 0">
>       <xsl:attribute name="id">
>         <xsl:call-template name="object.id"/>
>       </xsl:attribute>
>     </xsl:if>
> 
>     <xsl:call-template name="component.separator"/>
>     <xsl:call-template name="chapter.titlepage"/>
> 
>     <xsl:variable name="toc.params">
>       <xsl:call-template name="find.path.params">
>         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
>       </xsl:call-template>
>     </xsl:variable>
>    <xsl:if test="contains($toc.params, 'toc')">
>       <xsl:call-template name="component.toc">
>         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
>       </xsl:call-template>
>     </xsl:if>
>     <xsl:apply-templates/>
>     <xsl:call-template name="process.footnotes"/>
>   </div>
> </xsl:template>
> 
> to this:
> 
> <xsl:template match="chapter">
>   <div class="{name(.)}">
>     <xsl:if test="$generate.id.attributes != 0">
>       <xsl:attribute name="id">
>         <xsl:call-template name="object.id"/>
>       </xsl:attribute>
>     </xsl:if>
> 
>     <xsl:call-template name="component.separator"/>
>     <xsl:call-template name="chapter.titlepage"/>
> 
>     <xsl:apply-templates/>
>     <xsl:variable name="toc.params">
>       <xsl:call-template name="find.path.params">
>         <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
>       </xsl:call-template>
>     </xsl:variable>
>    <xsl:if test="contains($toc.params, 'toc')">
>       <xsl:call-template name="component.toc">
>         <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
>       </xsl:call-template>
>     </xsl:if>
>     <xsl:call-template name="process.footnotes"/>
>   </div>
> </xsl:template>
> 
> 
> then I get what I want.   (All I have done is move the <xsl:apply-templates/> up).
> 
> However if I put this template, or the original of the template, in my customization layer and use the original html\component.xsl, then the chunking goes all wrong.
> 
> Does anyone know why this is the case, or what the preferred way of achieving such behaviour might be?

The problem here is that the chunk.xsl stylesheet
also has a template match on chapter, to do the chunking,
and that template then does apply-imports to use the
components.xsl chapter template.  When you put
a match="chapter" template in your customization layer,
it has higher import precedence than the one
in chunk.xsl, and you lose your chunking.

To preserve chunking, you will need to copy the template
in chunk.xsl that starts with:

  <xsl:template match="set|book|part|preface|chapter|appendix
    ...

to your customization layer, perhaps changing the match
to just select chapter.

Then you need to convince it to use your new component/chapter
template.  When it does apply-imports, I don't think your
new chapter template will be used since it isn't being imported
(it is in the same customization file).
You may need to put that in a separate file
and import it to your customization layer, after
importing chunk.xsl.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]