This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: position() problem with // axis + parent numbering problem
- To: xsl-list at mulberrytech dot com
- Subject: Re: position() problem with // axis + parent numbering problem
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Tue, 18 Apr 2000 11:11:30 +0100 (BST)
- References: <38FBACEF.FCC49D9A@auckland.ac.nz> <38FC3002.D87ED59B@auckland.ac.nz>
- Reply-To: xsl-list at mulberrytech dot com
> In fact they are mutually exclusive (whooops),
exactly!
> just not what I was expecting.
what were you expecting? It looks OK to me.
Perhaps you wanted the (//text)[1] form which only returns one node
(see the second half of my example in first reply).
> Note that the first template has been called twice, and a position() call
> inside the template returns the correct position in the context list, yet
> the result appears to conflict with the predicate [1]
no they are not in conflict.
//text[1] is short for
/descendant-or-self::node()/child::text[1]
so the [1] refers to the order in the last step, ie the count from the
parent. this is not the same as /descendant-or-self::text[1]
so your node list selected in teh for-each selects every text node
that is the first text child of its parent. there are two of those
in your example, and so when _that_ list is being processed they have
position() 1 and 2 respectively.
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list