I have not used the ZipArchiveSerializer, but your XSLT is somewhat wrong:
The <zip-archive:archive>-element should be inside the
<xsl:template>-element.
Askild
-
moinuddin.ahmed wrote:
> Hi,
>
>
> I am trying to zip up contents of a directory.
> I have successfully got the Zip and directory working stand
> alone. Now I am trying to pass a directory and then zip the
> contents. I have pasted the contents of sitemap.xmap and .xsl
> file and the .xml file generated after reading the directory
> for your reference.
>
> I am getting error
>
> "Failed to execute pipeline.
>
> org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
> java.lang.RuntimeException: java.util.zip.ZipException: ZIP
> file must have at least one entry " If I use "html" to
> serialize instead of "zip", the contents of the directory are
> getting rendered correctly.
>
> Can some one let me know where I am going wrong.
> Thanks in advance.
> Regards,
> M
>
> Sitemap.xmap
> ==============================================================
> ==========
> =
> <map:match pattern="zipFolderActions">
>
>
> <map:generate type="directory"
> src="./{request-param:zipFolders}">
> <map:parameter name="depth" value="4"/>
> <map:parameter name="use-request-parameters"
> value="true"/>
> </map:generate>
> <map:transform src="stylesheets/dirzip.xsl"/>
> <map:serialize type="xml"/>
>
> </map:match>
>
> ===============================================================
>
> My DirZip.xsl is as follows:
>
> ==============================================================
> ==========
> =
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
>
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:dir="http://apache.org/cocoon/directory/2.0">
>
>
> <zip-archive:archive
> xmlns:zip-archive="http://apache.org/cocoon/zip-archive/1.0">
>
> <xsl:param name="dirprefix"/>
> <xsl:template match="/">
>
> <xsl:for-each select="dir:directory/dir:file">
>
>
> <zip-archive:entry>
> <xsl:attribute name="name" value="zipFile">
> </xsl:attribute>
> <xsl:attribute name="src"><xsl:value-of
> select='dir:directory/dir:[EMAIL PROTECTED]'/>
> </xsl:attribute>
>
>
>
> </zip-archive:entry>
> </xsl:for-each>
>
>
>
>
> </xsl:template>
> </zip-archive:archive>
> </xsl:stylesheet>
>
>
> =========================================
>
> The output of the directory reader is fine..It prints the following:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> - <dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
> name="CVS" lastModified="1083839789750" date="5/6/04 4:06 PM"
> size="0" sort="name" reverse="false" requested="true">
> <dir:file name="Entries" lastModified="1083817692000"
> date="5/6/04 9:58 AM" size="688" />
>
> <dir:file name="Entries.Extra" lastModified="1083817692000"
> date="5/6/04 9:58 AM" size="343" />
>
> <dir:file name="Repository" lastModified="1083740334000"
> date="5/5/04 12:28 PM" size="12" />
>
> <dir:file name="Root" lastModified="1083740334000"
> date="5/5/04 12:28 PM" size="48" />
>
> </dir:directory>
>
> Confidentiality Notice
>
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive
> use of the addressee(s) and may contain confidential or
> privileged information. If you are not the intended
> recipient, please notify the sender at Wipro or
> [EMAIL PROTECTED] immediately and destroy all copies of
> this message and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]