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] | [Elist Home]


Subject: Re: DOCBOOK-APPS: TOC in appendix


On Tue, Aug 13, 2002 at 06:55:34PM +0200, Michael Wiedmann wrote:
> Using:
> DocBook XML 4.2 (article)
> DocBook XSL 1.53.0
> Saxon V6.5.2
> 
> For chunked HTML I set the following in my customization layer
> (showing only the relevant part for my problem):
> 
>   <!-- Chunk the first top-level section? -->
>   <xsl:param name="chunk.first.sections" select="1"/>
> 
>   <!-- Depth to which sections should be chunked  -->
>   <xsl:param name="chunk.section.depth" select="2"/>
> 
>   <!-- How deep should recursive sections appear in the TOC? -->
>   <xsl:param name="toc.section.depth">2</xsl:param>
> 
>   <!-- Control depth of TOC generation in sections -->
>   <xsl:param name="generate.section.toc.level" select="3"/>
> 
> For all 'normal' sections I get the output I want, including TOCs 
> in sections up to level 3.
> 
> At the end of my diocument I have a <appendix>, which contains 
> several <section>s. 
> 
> For this appendix I _don't_ get a TOC at the beginning, only navigation
> entries at the top and the bottom of the page (which work like expected).
> 
> Is there any customization I can do to the stylesheets to get a TOC
> for this chunk too?

This was an interesting problem.  
The reason the TOC is not there is because in html/component.xsl,
there is a match="article/appendix" template that is used
in place of the normal appendix template when appendix is a child
of article instead of book.  The "article/appendix" template
does not output a TOC.  

So I tried copying that template to a customization layer
to add <xsl:call-template name="component.toc"/> like the
other appendix template has.  But it didn't work.  In fact,
inserting <xsl:message> told me my template wasn't even being
used.  I thought that was kind of strange.

I traced through the chunking templates, and found that
when it gets down to generating the content of a chunk, the
template named "chunk-element-content" executes an
<xsl:apply-imports/> rather than <xsl:apply-templates/>.
Apply-imports is used to ignore matches in the current
stylesheet and consider only imported templates. That's so
it gets the behavior from the original docbook.xsl
stylesheet for the content itself (since chunk.xsl is a
customization of docbook.xsl).

That means it ignores my new customized article/appendix
template and uses the original one imported from
docbook.xsl (which includes component.xsl as part of the
same import level).

So I tried importing my new template into my customization
layer, but that didn't work either.  That's because
there are two levels of import.  My customization imports
chunk.xsl, which imports docbook.xsl.  Mine was at the
wrong level.  I could only get it to work by editing
chunk.xsl to put my import after the docbook.xsl import.
And then it only worked with Saxon, not with xsltproc
(which may be a bug in xsltproc).
I don't think editing chunk.xsl is a good solution.

So I think you should file a bug report on SourceForge
to add a TOC to the article/appendix template, conditionally
controlled by the TOC parameters.  The article/appendix
TOC could be off by default in the 'generate.toc'
parameter, and then turned on in that parameter if you
want it.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


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


Powered by eList eXpress LLC