RE: Variable references in path expressions
"Michael Kay" <[email protected]> Thu, 28 Apr 2005 09:08:36 +0100
| Newsgroups | gmane.comp.web.query-languages |
|---|---|
| Message-ID | <[email protected]> |
> > 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