(: declare functions :) declare function local:cd-info($cd as element()? ) as element()? { let $t := $cd/title let $a := $cd/artist return

Title: {data($t)}
Artist: {data($a)}

};

Cd Collection

{ for $c in distinct-values(doc("../../samples/cdcatalog.xml")/catalog/cd/country) return

{$c} { for $x in doc("../../samples/cdcatalog.xml")/catalog/cd where $x/country = $c return

  • {local:cd-info($x)}
  • } CD# = {count(doc("../../samples/cdcatalog.xml")/catalog/cd[country = $c])}

    }