extract (xlink : string, [fromDataSource : boolean]) : nodeset

Using the method »extract()«, a list of the contents of any .zip file can be produced.


The parameter »xlink« expects an XLink to the .zip file in the system. If the method is executed directly on the object in which the .zip file is saved, the XLink only consists of the ID.

The parameter »fromDataSource« is optional as always and implicitly holds the value »true()«. It is thus indicated that the .zip file to be loaded is located on the data object on which the method is executed. If an XLink to a binary method that creates the .zip file has been specified, then the value »false()« must be transferred to the parameter »fromDataSource«.

<xsl:stylesheet xmlns:xsl="" xmlns:zip="" xmlns:onion="" version="1.0">
<xsl:template match="/">
<xsl:variable name="zipEntries" select="zip:extract(zipFile, true())" />
Determining the list of the contents of a .zip file

The variable »zipEntries« now contains a nodeset with all contents of the .zip file. The XML is flat, i.e. the contents are shown in one level, even if they are stored in folders in the .zip. This hierarchy is then found again in the access paths (see below).

The return value of the method »extract()« or the possible contents of the variable »zipEntries« from the above example, is shown in the following.

<entry fileExtension=".html" size="1895" name="index.html" />
<entry fileExtension=".jpg" size="2650" name="images\logo.jpg" />

Each real file in the .zip file is represented with an <entry> element. The path to the file within the .zip file is located in the attribute »name«. In the above example, the file »logo.jpg« is saved within the .zip in the folder »images«.