Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created February 17, 2016 10:13
Show Gist options
  • Save ableasdale/80d2a3bf2f3bfe6e50ac to your computer and use it in GitHub Desktop.
Save ableasdale/80d2a3bf2f3bfe6e50ac to your computer and use it in GitHub Desktop.
Sample CSV output
xquery version "1.0-ml";
declare namespace obj="http://marklogic.com/solutions/obi/object";
declare function local:header(){
text {"One,Two"}
};
declare function local:process($uri as xs:string) {
text {fn:string-join((cts:element-values(xs:QName("obj:id"), (), (), cts:document-query($uri)), cts:element-values(xs:QName("obj:type"), (), (), cts:document-query($uri))), ",")}
};
(
xdmp:add-response-header("Content-Type", 'text/plain; charset=utf-8'),
local:header(),
local:process(cts:uris((), ("limit=500"), cts:collection-query("object") ))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment