- From: Sergio Andreozzi <sergio.andreozzi@cnaf.infn.it>
- Date: Wed, 23 Mar 2005 00:54:40 +0100
- To: Michael Kay <mhk@mhk.me.uk>
- CC: "'Mukul Gandhi'" <mukul_gandhi@yahoo.com>, www-ql@w3.org
Michael Kay wrote:
> "where $A/$matches" is not wrong, but given that $A is a singleton, it's
> trivially the same as "where $matches".
>
> I think you can still avoid repeating the condition even when the "or"
> becomes an "and".
>
> <Results> {
> for $A in doc("data.xml")/ASet/A
> let $matchesB := $A/B[. = ("red","yellow")]
> let $matchesC := $A/C[. = ("chair","table")]
> where ($matchesB and $matchesC)
> return
> <A>
> {$A/@*, $matchesB, $matchesC }
> </A>
> }</Results>
I really like this solution. I will investigate more deeply my use case
with more complex examples and the "let" clause.
Thanks for the help,
Sergio
Received on Wednesday, 23 March 2005 00:17:25 UTC