Re: [xsl] Template-matching nodes from input vs nodes in variable based on their position

Subject: Re: [xsl] Template-matching nodes from input vs nodes in variable based on their position
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Jun 2015 17:30:46 -0000
Jorge . chocolate.camera@xxxxxxxxx wrote:

And yet, indeed as per your answers, if I query the position of that
node, the value returned is 1 instead of 3:

<xsl:sequence select="$FOO[position() eq 3]/position()"/> b 1

which looks bizarre to me.

If you look at http://www.w3.org/TR/xpath20/#id-path-expressions then you see that for
E1/E2
(where in your case E1 is $FOO[position() eq 3] and E2 the position() function call) it says that first E1 is evaluated and then "Each node resulting from the evaluation of E1 then serves in turn to provide an inner focus for an evaluation of E2".


So doing
E1/position()
always (as long as E1 evaluates to a sequence of nodes) returns 1 as the context size is 1.


Current Thread