RE: Re: Variable references in path expressions

> It will allow some programming idioms which will look strange at
> first, such as (1 to 5)/$x[.] to select the first 5 items in 
> $x,

This example is wrong, of course. "." changes inside the predicate. You
would have to use

(1 to 5)/subsequence($x, ., 1)

which isn't going to tempt anyone away from subsequence($x, 1, 5) or
$x[position()=1 to 5].

There are other examples that have atomic values on the left and nodes on
the right, though: for example the following looks quite handy:

(1 to 5)/<br/>

Michael Kay
http://www.saxonica.com/

 

Received on Wednesday, 27 April 2005 09:21:04 UTC