Re: [xsl] Select Deepest Node only in Iteration

Subject: Re: [xsl] Select Deepest Node only in Iteration
From: "J. Zhang" <j.zhang@xxxxxx>
Date: Fri, 13 Jul 2007 13:51:52 +0200
I want to output the deepest node. What I get now is:

//article/body[1]/section[6]/normallist[6]/item[1]
//article/body[1]/section[6]/normallist[6]
//article/body[1]/section[6]
//article/body[1]
//article

I only want to first item. When I set position()=1, I always get the
last item in the list, the root. When I set count(ancestor::node())=5, I
do get the first item, but 5 is not always the deepest level, e.g.
sometimes it is only 2.


jz

Michael Kay wrote:
> Start with a change in mindset. position() does work. It just isn't the
> answer to your particular requirement.
> 
> Within a sorted for-each, position() returns the position of a node in the
> sorted sequence.
> 
> I don't know what the solution to your requirement is. You haven't told us
> what you want to output, only that it's different to what position()
> outputs.
> 
> Michael Kay
> http://www.saxonica.com/

Current Thread