Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created June 9, 2014 11:36
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 ableasdale/313c0bb113a20344af2d to your computer and use it in GitHub Desktop.
Save ableasdale/313c0bb113a20344af2d to your computer and use it in GitHub Desktop.
xquery version "1.0-ml";
declare variable $URIS as xs:string+ := (cts:uris());
declare function local:create-parts-manifest($items) {
<parts xmlns="xdmp:zip">
{
for $item in $items
return element part {$item}
}
</parts>
};
declare function local:create-sequence-of-docs($items) {
(
for $item in $items
return doc($item)
)
};
(: Module main :)
let $zip := xdmp:zip-create(
local:create-parts-manifest($URIS),
local:create-sequence-of-docs($URIS)
)
return
xdmp:save("e:/myzip.zip", $zip,
<options xmlns="xdmp:save">
<encoding>utf8</encoding>
</options>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment