Skip to content

Instantly share code, notes, and snippets.

@dmcassel
Created March 25, 2014 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmcassel/9753936 to your computer and use it in GitHub Desktop.
Save dmcassel/9753936 to your computer and use it in GitHub Desktop.
declare function local:doc-compliance-map($uri, $terms)
{
let $map := map:new(
for $term in $terms
return map:entry($term, 0)
)
let $doc := fn:doc($uri)
let $_ :=
for $value in cts:element-values(xs:QName("compliance"), (), "item-frequency", cts:document-query($uri))
return map:put($map, $value, cts:frequency($value))
return $map
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment