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

RE: Variable references in path expressions

From: Michael Kay <mhk@mhk.me.uk>
Date: Thu, 28 Apr 2005 09:08:36 +0100
To: "'Xavier Franc'" <xfranc@online.fr>, <www-ql@w3.org>
Message-ID: <E1DR47Z-0000Tb-8L@lisa.w3.org>

> 
> Correct me if I am wrong, but an expression like
> 
> (1, 2, 3)/(1, 2, 3)
> 
> can as well be written with FLWR expressions:
> 
> for $i in (1, 2, 3) return (1, 2, 3)
> 
> or:
> 
> for $i in (1, 2, 3), $j in (1, 2, 3) return $j
> 
> which is more clear and as powerful.
> 

Yes, it's just a pain having to declare a variable when you don't need one,
and it's stylistically very awkward to use statement introduced by a keyword
nested deeply inside an expression that's otherwise using an infix operator
style. It's very much more convenient to be able to write things like

concat(min(//*/local-name()), '-', max(//*/local-name()))

rather than

concat(min(for $n in //* return local-name($n)), '-', max(for $n in //*
return local-name($n))

As I've said, though, I personally think it's a bit of a compromise and a
dedicated mapping operator would have been better. But compromising is what
committees do...

Michael Kay

 
Received on Thursday, 28 April 2005 08:11:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:17 UTC