cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Cameron <>
Subject Re: ZipArchiveSerializer question
Date Sun, 24 Aug 2008 23:45:30 GMT

Hello Alfred,

Say have a url '' and I want to add an
option to save the same test.xml file as a zip archive.

I see now that if I have the following sitemap:

	<map:match pattern="*.zip">
        <map:generate src="nothing.xml" type="file"/>
	<map:transform src="zip.xsl">
		<map:parameter name="source" value="{1}"/>	
        <map:serialize type="zip"/>

      <map:match pattern="*">
        <map:generate src="{1}.xml"/>
        <map:serialize type="xml"/>

Where nothing.xml is effectively an empty xml file having only <xml></xml>

And the zip.xsl is as follows:

<xsl:stylesheet version="1.0"
  <xsl:param name="source"/>
  <xsl:template match="/">
	  <zip:archive xmlns:zip="">
			<xsl:attribute name="name"><xsl:value-of
			<xsl:attribute name="src">cocoon:/<xsl:value-of

I am directing the output of the "*" pipeline into the "*.zip" pipeline.

This almost seems to work, but the browser does not seem to understand that
file is a zip, so maybe I'm still doing something incorrectly, thanks for
your help.

Steve Cameron

Alfred Nathaniel wrote:
> On Wed, 2008-08-20 at 20:54 -0700, Steve Cameron wrote:
>> Hello,
>> Is it possible to use the ZipArchiveSerializer and process the generator
>> output straight off without sending it to a disk file first?
>> I think this stream compression is possible but gives a less compressed
>> result.
> I don't quite understand what your question is.
> The ZIPArchiveSerializer does not write any on-disk ZIP file.  It
> buffers in memory and streams it to the HTTP response.
> If you on the client side don't want to store the ZIP file, you can
> unpack it immediately:
>     curl http://... | jar xfv -
> HTH, Alfred.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Cocoon - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message