This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: condition attribute + XSL + generated toc
- To: docbook-apps at lists dot oasis-open dot org, ma dot darche at free dot fr
- Subject: Re: DOCBOOK-APPS: condition attribute + XSL + generated toc
- From: Bob Stayton <bobs at sco dot COM>
- Date: Thu, 05 Jul 2001 12:05:32 -0700 (PDT)
> 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