(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>
<<<  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    >>>