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

Re: [xsl] failed to find the right child node


Subject: Re: [xsl] failed to find the right child node
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 31 Aug 2006 17:08:04 +0100

> No one replays my question by now. 
If you get no replies, normally it means that no one understood the
question, so just reposting doesn't really help.


there really isn't any need to keep passing the entire node set and
having a counter that you increment, just have a parameter that is
the nodes to be processed, typically you porcess $nodes[1] and then you
recurse on $nodes[position()!=1] and stop when $nodes is empty.

//fast_load_stream[position()=$index]"

means

/descendant-or-self::node()/fast_load_stream[position()=$index]"

so it selects every fast_load_stream that is the $index'th child of its
parent.

You want a global variable

<xsl:variable name="nodes" select="//fast_load_stream"/>
and then use $nodes[position()=$index]
or as I say, make $nodes a parmeter that contains one fewer node at each
iteration.

	<xsl:when test="fastloadStream/objects/channel_object" >
is always going to be false as the current node appears to be always /
which doesn't have a fastloadStream child element. 

It seems likely that the number that you are  trying to calculate is
obtainable just from a simple xpath count and doesn't require a
recursive template, but I'm not sure as I don't follow your description.
what output do you want from your posted input?

David


Current Thread
Keywords