This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: [docbook] XSL question
- From: "Paul A. Hoadley" <paulh at logicsquad dot net>
- To: Matej Cepl <cepl at surfbest dot net>
- Cc: docbook at lists dot oasis-open dot org
- Date: Mon, 1 Mar 2004 15:39:34 +1030
- Subject: Re: [docbook] XSL question
- References: <200402292215.28334.cepl@surfbest.net>
On Sun, Feb 29, 2004 at 10:15:20PM -0500, Matej Cepl wrote:
> <xsl:template match="sect1">
> <h1>
> <xsl:value-of select="title"/>
> </h1>
> <xsl:apply-templates/>
> </xsl:template>
>
> then this piece of source code:
>
> <sect1><title>New vimoutliner</title>
> <warning><para>February 18, 2004</para></warning>
> <para>Ukazkovy text</para>
> </sect1>
>
> gives this output:
>
> <h1>New vimoutliner</h1>New vimoutliner
> <p class="date">February 18, 2004</p>
> <p>Ukazkovy text</p>
>
> which is not what I want (text of <title> is used twice).
You are selecting 'title' explicitly, and then matching it again with
the unrestricted 'apply-templates'---the default template (since there
is no explicit 'title' template) just prints the content of the
'title' element.
Among the possible solutions, you could leave everything precisely as
it is and add:
<xsl:template match="title"/>
Or, delete everything within and including the 'h1' element in the
'sect1' template, and add:
<xsl:template match="title">
<h1><value-of select="."/></h1>
</xsl:template>
--
Paul.
mailto:paulh@logicsquad.net
mailto:phoadley@maths.adelaide.edu.au
To unsubscribe from this list, send a post to docbook-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.