xsl-list
[Top] [All Lists]

Re: [xsl] document function cached?

2013-02-07 15:43:21
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>