Skip to content

Instantly share code, notes, and snippets.

@dariok
Created April 10, 2018 12:24
Show Gist options
  • Save dariok/224b5510760097b4c4896d915badc49b to your computer and use it in GitHub Desktop.
Save dariok/224b5510760097b4c4896d915badc49b to your computer and use it in GitHub Desktop.
eXist: serialize XML to file
xquery version "3.1";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
let $result := transform:transform($xml, $xsl, $transformationParams)
let $serializazionParams :=
<output:serialization-parameters>
<output:method value="xml"/>
<output:omit-xml-declaration value="no"/>
<output:doctype-public value="-//OASIS//DTD DocBook XML V4.2//EN"/>
<output:doctype-system value="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"/>
<output:encoding value="ISO-8859-1"/>
<output:indent value="yes"/>
</output:serialization-parameters>
let $write := file:serialize($result, $fullPathToFile, $serializazionParams)
return response:redirect-to(xs:anyURI($fullPathToFileOnWeb))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment