Skip to content

Instantly share code, notes, and snippets.

@emchateau
Forked from mblakele/gist:1342280
Last active August 29, 2015 14:14
Show Gist options
  • Save emchateau/e08badae9c28861fabb6 to your computer and use it in GitHub Desktop.
Save emchateau/e08badae9c28861fabb6 to your computer and use it in GitHub Desktop.
<sales-qty-by-product>{
for $pname in distinct-values(
doc("sales-records.xml")/*/record/product-name)
order by $pname
return
<product name="{$pname}">{
sum(
doc("sales-records.xml")/*/record[
product-name eq $pname ]/qty)
}</product>
}</sales-qty-by-product>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment