Skip to content

Instantly share code, notes, and snippets.

@baskaufs
Forked from CliffordAnderson/example.xqy
Last active August 29, 2015 14:15
Show Gist options
  • Save baskaufs/dadb1e3012a5bf2147a7 to your computer and use it in GitHub Desktop.
Save baskaufs/dadb1e3012a5bf2147a7 to your computer and use it in GitHub Desktop.
let $books :=
<books>
<book class="fiction">Book of Strange New Things</book>
<book class="nonfiction">Programming Scala</book>
<book class="fiction">Absurdistan</book>
<book class="nonfiction">Art of R Programming</book>
<book class="fiction">I, Robot</book>
</books>
for $book in $books/book
let $title := $book/text()||"&#10;"
let $class := "&#10;"||$book/@class||"&#10;"
order by $title
group by $class
return ($class, $title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment