Project

Profile

Help

Bug #3434 ยป zip-archive.xsl

Liam Quin, 2017-09-11 01:28

 
<?xml version="1.0"?>
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:archive="http://expath.org/ns/archive"
xmlns:bin="http://expath.org/ns/binary"
xmlns:file="http://expath.org/ns/file"
>

<xsl:template match="/">
<xsl:variable name="entries" as="map(xs:string, map(xs:string, item()*))">
<xsl:sequence select="map {
'mimetype' : map {
'compression-level' : 'store',
'content' : bin:encode-string('application/epub+zip', 'utf-8'),
'position' : '1'
},
'socks' : map {
'compression' : 'deflate',
'compression-level' : '9',
'content' : xs:base64Binary('SSBhbSBub3Qgd2VhcmluZyBzaG9lcyBvciBzb2NrcyB0b2RheS4K')
}
}"/>
</xsl:variable>

<xsl:variable name="one-archive" as="xs:base64Binary"
select="archive:create-map( $entries ) "/>

<xsl:sequence select="
file:write-binary(
'output.zip',
$one-archive
)
"/>
</xsl:template>

</xsl:stylesheet>
    (1-1/1)