Re: broken use-case 1.1.9.4 Q4 ?

This version has a new problem: it doubles up the <last> and <first> 
elements because $first and $last are already elements.

Example: 
<last><last>Abiteboul</last></last><first><first>Serge</first></first>

So the original suggestion of { $last, $first } or { $last }{ $first } 
should be used.

--Sarah

At 06:13 PM 7/1/2003, Xavier C. FRANC wrote:

>
> >It seesm that the use-case 1.1.9.4 Q4 (may 2003) is erroneous:
>
> Thanks, Xavier, you are right.
>
> Here is the version I wrote to fix this problem:
>
> <results>
>    {
>      let $a := doc("http://www.bn.com/bib/bib.xml")//author
>      for $last in distinct-values($a/last),
>          $first in distinct-values($a[last=$last]/first)
>      order by $last, $first
>      return
>          <result>
>              <author>
>                 <last>{ $last }</last>
>                 <first>{ $first }</first>
>              </author>
>              {
>                  for $b in doc("http://www.bn.com/bib.xml")/bib/book
>                  where some $ba in $b/author
>                        satisfies ($ba/last = $last and 
> $ba/first=$first)
>                  return $b/title
>              }
>          </result>
>    }
> </results>
>
> Jonathan

Received on Wednesday, 15 October 2003 13:49:44 UTC