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

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


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:

Current Thread