addLiteral (filename : string, xlink : string, encoding : string) : void

The method »addLiteral()« can be used to add a text file to the .zip. Text file just means here a file produced by means of a literal method, unlike a binary file, which is produced using a binary method.

Examples of text files are files with the endings .txt or .csv. HTML or CSS files can also be produced in this way.


The name under which the file is to be listed in the .zip later on is to be transferred to the first parameter »filename«.

An XLink to the literal method, which produces the file, is transferred to the parameter »xlink«.

The encoding of the later text file is transferred to the parameter »encoding«.


The following example produces an empty .zip binary stream, adds a .csv file, and lastly produces the .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:variable name="addItem" select="zip:addLiteral('empfänger.csv', c.xlink('collectRecipients'), 'ISO-8859-15')" />
<xsl:value-of select="zip:finish()" />
<b:output mimeType="application/zip">
<b:webResponse dispositionType="attachment" filename="" />

It is to be noted that the method specified in the XLink may have no more than the access protection »protected«.