http://onion.net/2010/compression/zip

extractEntry (entry : nodeset) : void

The method »extractEntry()« is needed in order to extract an entry from a .zip archive. »extractEntry()« is applied in binary methods so that the extracted content can be used directly as a binary file in the rendering.

Parameter

The method is not to be used on its own. It is more of a supplement to the method »extract()«. For an <entry> element selected in the return XML of this method must be transferred as a parameter of the method »extractEntry()«.

Example

<xsl:stylesheet xmlns:b="http://onionworks.net/2004/renderengine/binary" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zip="http://onion.net/2010/compression/zip" xmlns:onion="http://onionworks.net/2004/data" version="1.0">
<xsl:template match="/">
<xsl:variable name="entry" select="zip:extract(zipFile, true())/zipArchive/entry[@name = 'images/logo.jpg']" />
<xsl:value-of select="zip:extractEntry($entry)" />
<b:output mimeType="image/jpeg">
<b:webResponse expires="60" />
</b:output>
</xsl:template>
</xsl:stylesheet>
Using the method »extractEntry()«

First of all, the list of contents of the .zip file is determined using the method »extract()« and the nodeset for the content "logo.jpg" is saved in the folder "images" in the variable »entry«.

This XML snippet is then written into the binary stream with the method »extractEntry()«.

Usually, the path of the file would be taken as a parameter and the mimetype for the binary output stream dynamically determined using the file extension.

See also