Re: [xsl] document function cached?

Subject: Re: [xsl] document function cached?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 07 Feb 2013 21:43:10 +0000
On 07/02/2013 20:54, Michel Hendriksen wrote:
But position() would return a number and it seems such an obvious way
to use it as an index...

Which number?


1 returns a number as well, and [1] means [position()=1] given that any
numeric expression is turned into a filter by testing against position().

You wanted to access the value of position() current before the xpath
started but for that you have to do

index-of($sequence,position())

as a function such as index-of (unlike a path step or filter0 does not
locally redefine position().

$sequence[5] and index-of($sequence,5)

are the same thing but


$sequence[position()] and index-of($sequence,position())


are different as in the first position() refers to position in the
sequence so the filter is position()=position() and always true
in the second position() refers to a value set in an outer context.

David






-- google plus: https:/profiles.google.com/d.p.carlisle

Current Thread