W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2005

RE: Re: Variable references in path expressions

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 27 Apr 2005 10:20:31 +0100
To: "'Michael Kay'" <mhk@mhk.me.uk>, "'Henry Luo'" <henryluo@vibrasoft.net>, <www-ql@w3.org>
Message-ID: <E1DQij5-0007BT-Ri@lisa.w3.org>

> 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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:44 UTC