create (level : number) : void

A new. zip binary stream can be produced with the method »create()«.


The parameter »level« indicates the degree of compression here. This is represented by a number between 0 and 10.

The choice of the compression degree should be made conditional on the contents of the .zip file. If mainly .jpeg pictures are to be zipped, a compression level of 0 makes good sense since the files are already compressed. Further compression could have a negative effect on the quality.


Usually, an empty .zip binary stream is created first with »create()«. This is then filled gradually with contents. The binary stream is then completed with the method »finish()«, meaning the file can be produced via a <b:output /> element.


The following example produces an empty .zip file.

<xsl:stylesheet xmlns:xsl="" xmlns:b="" xmlns:zip="" xmlns:onion="" version="1.0">
<xsl:template match="/">
<xsl:variable name="zip" select="zip:create(0, 'off')" />
<xsl:value-of select="zip:finish()" />
<b:output mimeType="application/zip">
<b:webResponse dispositionType="attachment" filename="" />

See also