idref
2003-11-12 11:32:24 Per Bothner
This should get you on the right track. Note that for more complex conditions you might want to use a 'where' clause rather than a [predicate].
let $id := "sai@yahoo.com",
for $paper in $doc/PAPER[@EMAILID = $id],
for $author in $doc/AUTHOR[@EMAILID = $id]
return
<result PAPERID="{$paper/@PAPERID}">
{$author/FNAME}
<result>
This assumes you have a specific emailid. If you want this for all emailids, you could do:
for $paper in $doc/PAPER,
for $author in $doc/AUTHOR
where $paper/@EMAILID = $auther/$EMAILID
return
<result PAPERID="{$paper/@PAPERID}">
{$author/FNAME}
<result>
XQuery does not have the => operator.