<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6001.18099" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2>There are some cases where using a predicate may be 
inconvenient, but it is always possible. This query is equivalent to 
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2>distinct-values($values)[let $v := . return count($values[. 
= $v] &gt; 2]</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2>or if you prefer (or if you are restricted to XPath 2.0 
syntax)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2>distinct-values($values)[exists(index-of($values, 
.))[3]]</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2><SPAN 
class=411025009-10092008></SPAN></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2><SPAN class=411025009-10092008>Michael 
Kay</SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2><SPAN class=411025009-10092008><A 
href="http://www.saxonica.com/">http://www.saxonica.com/</A></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=411025009-10092008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> talk-bounces@x-query.com 
  [mailto:talk-bounces@x-query.com] <B>On Behalf Of </B>Rémi 
  Dewitte<BR><B>Sent:</B> 10 September 2008 10:35<BR><B>To:</B> 
  timothymarc@freenet.de<BR><B>Cc:</B> Robert Koberg; 
  talk@x-query.com<BR><B>Subject:</B> Re: [xquery-talk] FLOR or 
  FLWOR<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV dir=ltr>Hi,<BR>I do have an example. Correct ?<BR><BR>for $v in 
  distinct-values($values) where count($values[. = $v]) &gt; 2 return 
  $v<BR><BR>Rémi<BR><BR>
  <DIV class=gmail_quote>On Wed, Sep 10, 2008 at 11:02 AM, <SPAN dir=ltr>&lt;<A 
  href="mailto:timothymarc@freenet.de">timothymarc@freenet.de</A>&gt;</SPAN> 
  wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hey 
    Rob,<BR><BR>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.<BR><BR>But the where is essential in some case. But 
    you're right, most of the selections can be done with 
    XPath.<BR><BR>HTH<BR>Timothy<BR>----- original Nachricht 
    --------<BR><BR>Betreff: [xquery-talk] FLOR or FLWOR<BR>Gesendet: Mi 10 Sep 
    2008 03:02:44 CEST<BR>Von: "Robert Koberg"&lt;<A 
    href="mailto:rob@koberg.com">rob@koberg.com</A>&gt;<BR><BR>&gt; Hi,<BR>
    <DIV class=Ih2E3d>&gt;<BR>&gt; Where would you use 'where' that couldn't be 
    handled by XPath? In<BR>&gt; other words, why is there a 
    where?<BR>&gt;<BR></DIV>&gt; best,<BR>&gt; -Rob<BR>
    <DIV class=Ih2E3d>&gt; 
    _______________________________________________<BR>&gt; <A 
    href="mailto:talk@x-query.com">talk@x-query.com</A><BR>&gt; <A 
    href="http://x-query.com/mailman/listinfo/talk" 
    target=_blank>http://x-query.com/mailman/listinfo/talk</A><BR>&gt;<BR><BR></DIV>--- 
    original Nachricht Ende ----<BR>
    <DIV>
    <DIV></DIV>
    <DIV 
    class=Wj3C7c><BR><BR>_______________________________________________<BR><A 
    href="mailto:talk@x-query.com">talk@x-query.com</A><BR><A 
    href="http://x-query.com/mailman/listinfo/talk" 
    target=_blank>http://x-query.com/mailman/listinfo/talk</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>