(Q15) Make an alphabetic list of publishers. Within each publisher, make a list of books, each containing a title and a price, in descending order by price.

<publisher_list>
   FOR $p IN distinct(document("bib.xml")//publisher)
   RETURN
      <publisher>
         <name> $p/text() </name> ,
         FOR $b IN document("bib.xml")//book[publisher = $p]
         RETURN
            <book>
               $b/title ,
               $b/price
            </book> SORTBY(price DESCENDING)
      </publisher> SORTBY(name)
</publisher_list>

XSLT equivalent to (Q15)

<publisher_list xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:for-each select="document('bib.xml')//publisher[not(.=preceding::publisher)]">
    <xsl:sort select="."/>
    <publisher>
      <name><xsl:value-of select="."/></name>
      <xsl:for-each select="document('bib.xml')//book[publisher=current()]">
        <xsl:sort select="price" order="descending"/>
        <book>
          <xsl:copy-of select="title"/>
          <xsl:copy-of select="price"/>
        </book>
      </xsl:for-each>
    </publisher>
  </xsl:for-each>
</publisher_list>
<<<  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    >>>