[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Numbering Consecutive Nodes


Subject: Re: [xsl] Numbering Consecutive Nodes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 31 May 2006 12:10:09 +0100

	<xsl:template match="PageContent//node()">

I don't think that you want to match _all_ nodes below PageContent This
would include text nodes comments and anything else. If you apply
templates to any text node this template will generate an error as
		<xsl:copy>
will copy the text node but then 	<xsl:attribute name="id">
will try to make an attribute on a text node which obviously isn't
allowed. Change node() to * in the match pattern.

By default xsl:number just counts children of the current parent you want
<xsl:number level="any"/>

		<xsl:apply-templates
select="PageContent//node()" />

This selects all descendents of the PageContent child of the current
node. However the current node (which is a descendent of PageContent)
has no PageContent child so this will select nothing.

You just want
<xsl:apply-templates/>
here the default behaviour of just processing the child nodes is what
you want. (Lower descendendts will be recursively processed when the
templates matching the child nodes are executed.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread