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.


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()«.


<xsl:stylesheet xmlns:b="" xmlns:xsl="" xmlns:zip="" xmlns:onion="" 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" />
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