xdmp:zip-create( $manifest as node(), $nodes as node()+ ) as binary()
Create a zip file from a list of nodes.
While you can create a zip file of encrypted content,
xdmp:zip-create
does not have the
capability to encrypt the content to be zipped.
The
<part>
elements
in the
manifest should contain relative paths so the zip file can be
unpacked into its own directory; do not start the path with a
forward slash or a backslash.
To support creating Open
Container Format archives for the EPUB format,
xdmp:zip-create
will not
compress the first part if it is named "mimetype".
let $zip := xdmp:zip-create( <parts xmlns="xdmp:zip"> <part>mydoc.xml</part> <part>mypicture.jpg</part> </parts>, (doc("/mydoc.xml"), doc("/mypicture.jpg"))) return xdmp:save("c:/tmp/myzip.zip", $zip) (: Creates a zip archive that includes the documents "/mydoc.xml" : and "/mypicture.jpg", then saves that to the filesystem. :)
(: the "mimetype" file will not be compressed, so as to support the EPUB format :) let $zip := xdmp:zip-create( <parts xmlns="xdmp:zip"> <part>mimetype</part> <part>META-INF/container.xml</part> <part>OEBPS/content.opf</part> <part>OEBPS/content.pdf</part> </parts>, (document { "application/epub+zip" }, doc("/my-doc/container.xml"), doc("/my-doc/content.opf"), doc("/my-doc/content.pdf") )) return xdmp:save("c:/tmp/mydoc.epub", $zip) (: Creates a zip archive that meets the OCF specification, : then saves that to the filesystem. :)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.