Ok…  I actually had to solve a similar issue a few weeks ago. I think I’m in a early stage of Alzheimer ;-(

 

So here is the solution:

 

     

      if (submitId.equals("viewXML")) {

            //generate xml snippet which lists the selected topics and start the complete datasheet process from there

            cocoon.sendPage(

                  "datasheetContainer",

                {

                  "data": viewData2

                }

            );               

      } else if (submitId.equals("downloadZIP")) {

           

            //we have to change the filename of attachment

            var response = cocoon.response;          

            response.setHeader(

                "Content-Disposition",

                "attachment; filename=" + productId + ".zip"

            );         

           

            cocoon.sendPage(

                        productId + ".zip",

                      {

                        "data": viewData2

                      }

                  );               

      }    

 

Cheers,

Robby Pelssers

http://robbypelssers.blogspot.com/

 

 

 

From: Robby Pelssers [mailto:robby.pelssers@ciber.com]
Sent: Tuesday, December 15, 2009 4:03 PM
To: users@cocoon.apache.org
Subject: Question regarding zip serializer (filename becomes xxxx.continue)

 

Hi all,

 

I’ve setup some Pipelines which transform some xml documents into DITA format.  So what I and up with is a <map> and several <topic>’s. 

 

The user should be able to render a html preview or download the DITA result fragments as zip-file.

 

So in my flowscipt I check which submitbutton the user hits and dynamically determine the pipeline which needs to get invoked:

      var view =

            submitId.equals("viewXML")

            ? "datasheetContainer"

            : productId + ".zip";

 

      //generate xml snippet which lists the selected topics and start the complete datasheet process from there

      cocoon.sendPage(

            view,

          {

            "data": viewData2

          }

      );   

 

 

My relevant sitemap snippets:

      <map:match pattern="datasheetContainer">

        <map:generate src="data/datasheet.jx" type="jx" label="step-1"/>

        <map:transform type="cinclude" label="step-2"/>

        <map:transform src="xslt/includePackageAndProductXml.xslt" label="step-3"/>

        <map:transform type="cinclude" label="step-4"/>     

        <map:transform src="xslt/addGroupId.xslt" type="saxon" label="step-5"/>          

        <map:transform src="xslt/createMapAndTopics.xslt" type="saxon" label="step-6"/> 

        <map:transform src="xslt/sortNonQuantitativeTables.xslt"/> 

        <map:transform type="cinclude" label="step-7"/>

        <map:transform src="xslt/replaceBoxDimensions.xslt" type="saxon" label="step-8"/>

        <map:transform src="xslt/mergeParametricTableCells.xslt" type="saxon" label="step-9"/>

        <map:transform src="xslt/cleanup.xslt" type="saxon"/>

        <map:transform src="xslt/escapeHtml.xslt" type="saxon"/>

        <map:serialize type="productxml"/> 

      </map:match>

 

      <map:match pattern="*.zip">

        <map:generate src="cocoon://datasheetContainer"/>

        <map:transform src="xslt/datasheet2zip.xslt" type="saxon" label="zip"/>

        <map:serialize type="zip"/>       

      </map:match>

 

The problem I am facing is that the download dialogue now pops up with

U have chosen to download the file xxxyyyyzzzz.continue

 

But what I wanted was PH3330L.zip for example.

 

Anyone who knows if I can change this behaviour somehow?  

 

Kind regards,

Robby