(Q12) Invert the structure of the input document so that, instead of each book element containing a list of authors, each distinct author element contains a list of book-titles.
<author_list>
FOR $a IN distinct(document("bib.xml")//author)
RETURN
<author>
<name> $a/text() </name>,
FOR $b IN document("bib.xml")//book[author = $a]
RETURN $b/title
</author>
</author_list>
|
|||
|