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


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: [docbook] XSL question


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/.


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