This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: position() problem with // axis + parent numbering problem



>  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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]