Create a list of all the title-author pairs, with each pair enclosed in
a result
element.
<results>
{
for $book in doc("bib.xml")/bib/book,
$title in $book/title,
$author in $book/author
return
<result>
{ $title }
{ $author }
</result>
}
</results>
Adapted from XML Query Use Cases