Joerg Heinicke wrote:

Ah thanks.
That worked much better.

Magne




On 21.03.2004 13:19, Magne Skjeret wrote:

Hi

I have some problems when trying to create a zip file.

I have applied the settings from http://cocoon.apache.org/2.1/userdocs/serializers/ziparchive-serializer.html in my sitemap.
<map:match pattern="html/*.zip">
<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0";>
<zip:entry name="{1}.xml" src="http://{request-param:file}"/>
</zip:archive>
</map:match>


But when trying to use it, it claims that the namespace is not valid.

From the web page:

cause

Invalid namespace 'http://apache.org/cocoon/zip-archive/1.0'


Is there anyone that can shed some light on this?


This code must not be written into the sitemap, but into a file/stream that is processed by the pipeline. This means you can for example write an XML file with the above zip:archive code. The sitemap would look like:

<map:match pattern="html/*.zip">
  <map:generate src="zip.xml"/>
  <map:serialize type="zip"/>
</map:match>

To make it dynamic, add a transformer, that takes the value {1} as parameter and replaces the entry in the XML file:

<map:match pattern="html/*.zip">
  <map:generate src="zip.xml"/>
  <map:transform src="addzipentry.xsl">
    <map:parameter name="entryname" value="{1}.xml"/>
    <map:parameter name="entrysrc" value="http://{request-param:file}"/>
  </map:transform>
  <map:serialize type="zip"/>
</map:match>

zip.xml:

<zip:archive xmlns:zip="http://apache.org/cocoon/zip-archive/1.0";>
</zip:archive>

addzipentry.xsl:

<xsl:stylesheet>

<xsl:param name="entryname" select="''"/>
<xsl:param name="entrysrc" select="''"/>

<xsl:template match="zip:archive">
  <xsl:copy>
    <zip:entry name="{$entryname}" src="{$entrysrc}"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>

Hope this helps.

Joerg

---------------------------------------------------------------------
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]



Reply via email to