[xquery-talk] FLOR or FLWOR

Michael Kay mike at saxonica.com
Wed Sep 10 12:01:15 PDT 2008


There are some cases where using a predicate may be inconvenient, but it is
always possible. This query is equivalent to 
 
distinct-values($values)[let $v := . return count($values[. = $v] > 2]
 
or if you prefer (or if you are restricted to XPath 2.0 syntax)
 
distinct-values($values)[exists(index-of($values, .))[3]]
 
Michael Kay
http://www.saxonica.com/
 
 


  _____  

From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Rémi Dewitte
Sent: 10 September 2008 10:35
To: timothymarc at freenet.de
Cc: Robert Koberg; talk at x-query.com
Subject: Re: [xquery-talk] FLOR or FLWOR


Hi,
I do have an example. Correct ?

for $v in distinct-values($values) where count($values[. = $v]) > 2 return
$v

Rémi


On Wed, Sep 10, 2008 at 11:02 AM, <timothymarc at freenet.de> wrote:


Hey Rob,

i have had a situation in where the XPath predicate selection does not fit
my requirements. I think it was something concerning a query, that combines
to sequences, but i'm not sure. It is a long time ago and i can't find the
example.

But the where is essential in some case. But you're right, most of the
selections can be done with XPath.

HTH
Timothy
----- original Nachricht --------

Betreff: [xquery-talk] FLOR or FLWOR
Gesendet: Mi 10 Sep 2008 03:02:44 CEST
Von: "Robert Koberg"<rob at koberg.com>

> Hi,

>
> Where would you use 'where' that couldn't be handled by XPath? In
> other words, why is there a where?
>

> best,
> -Rob

> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
>


--- original Nachricht Ende ----



_______________________________________________
talk at x-query.com
http://x-query.com/mailman/listinfo/talk



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20080910/dae7313d/attachment.htm


More information about the talk mailing list