Hello Alfred,

Say have a url 'http://mysite.com/cocoon/test.xml' 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:transform>
        <map:serialize type="zip"/>
        </map:match>

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

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

And the zip.xsl is as follows:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns="http://mine";>
  <xsl:param name="source"/>
  <xsl:template match="/">
          <zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0";>
                <zip:entry>
                        <xsl:attribute name="name"><xsl:value-of
select="$source"/></xsl:attribute>
                        <xsl:attribute name="src">cocoon:/<xsl:value-of
select="$source"/></xsl:attribute>
                </zip:entry>
          </zip:archive>
  </xsl:template>
</xsl:stylesheet>

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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ZipArchiveSerializer-question-tp19082078p19136064.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to