On 10.05.2004 15:37, [EMAIL PROTECTED] 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.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:dir="http://apache.org/cocoon/directory/2.0"; xmlns:zip="http://apache.org/cocoon/zip-archive/1.0";>

<xsl:template match="/">
  <zip:archive>
    <xsl:apply-templates select="dir:directory"/>
  </zip:archive>
</xsl:template>

<xsl:template match="dir:directory">
  <xsl:apply-templates select="dir:directory/dir:file"/>
</xsl:template>

<xsl:template match="dir:file">
  <xsl:variable name="src">
    <xsl:for-each select="ancestor::*">
      <xsl:value-of select="@name"/>
      <xsl:text>/</xsl:text>
    </xsl:for-each>
    <xsl:value-of select="@name"/>
  </xsl:variable>
  <zip:entry name="[EMAIL PROTECTED]" src="{$src}"/>
</xsl:template>

No tested. Fix the pathes in the way you need them.

Joerg

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



Reply via email to