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: condition attribute + XSL + generated toc


> From: "M.-A. DARCHE" <ma.darche@free.fr>
> 
> Hello everyone,
> 
> I need that the HTML output of a DocBook XML document (which is a FAQ)
> does not contain any part related to elements marked with the
> attribute condition=3D"long".
> 
> So I'm using a customized XSL stylesheet containing those instructions:
> <xsl:template match=3D"*">
> <xsl:if test=3D"@condition!=3D'long' or not(@condition)">
> <xsl:apply-imports/>
> </xsl:if>
> </xsl:template>
> 
> This works fine for the content of the generated document, BUT
> unfortunately the table of contents does still show the non-present
> elements.
> I've checked qandaset.xsl from docbook-xsl distribution with no clue and
> moreover my understanding of XSL tells me that the toc generation should
> be affected as well by my customization.
> 
> Could anyone tell me how I should proceed to get rid of the non-existent
> entries in the toc ?

I ran into a similar problem and never did figure out why
the TOC included references to elements that were excluded.

I solved my problem by creating a small stylesheet to first
filter my source file to a temporary xml file with the
elements excluded, and then process the resulting temp file
with the standard Docbook stylesheets.  That way I didn't
need any customization at all, and the Docbook stylesheets
had no knowledge of the excluded elements.  Here is my prefilter
stylesheet adapted to your needs:

<?xml version='1.0'?>
<xsl:stylesheet
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          version='1.0'>
<xsl:output method="xml"/>

<xsl:template match="*|/">
        <xsl:copy>
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates/>
        </xsl:copy>
</xsl:template>

<xsl:template match="*[@condition='long']">
</xsl:template>

</xsl:stylesheet>


bobs
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