What does obviouly not work is the referencing of a directory in zip:entry/@src. But from the example in the above docu it *might* work to use "concat($filePath,$fileName)" (named as $fileToBeZipped in your code below) as both zip:entry/@src and zip:entry/@name.
Joerg
PS: Is there any reason that there are always so many linebreaks in your mails? Could you switch off HTML mails for the mailing lists?
On 17.05.2004 08:51, [EMAIL PROTECTED] wrote:
Hi, I am trying to zip a directory and all the content of the directory
I have a directory structure as follows:
C:\Directory | |-- dirA |--------FileA.text |--------FileB.text |-- dirB |--FileRootA.txt |--FileRootB.txt
I have written an xsl to read this using Directory generator and zip the files and the directories recursively till n level.. What I found, all the files at all the levels are getting zipped but not directory. For directories I get the following error:
'If I comment the zip entry for directories, files gets zipped correctly.
"org.apache.cocoon.ProcessingException: Failed to execute pipeline.: java.lang.RuntimeException: org.apache.excalibur.source.SourceNotFoundException: file:/C:/directory/ doesn't exist"
Though the directory very much exists. I have tried hard coding and adding the same also, but no luck. I have the xsl written as below:
Can some one please check out and let me know where I am going wrong, or is it that we can only zip files using Cocoon and not directories.
Thanks in advance. Regards, Moin
======================== Sitemap.xmap is as follows
<map:match pattern="zipFolderActions">
<map:generate type="directory" src="{request-param:zipFolders}">
<map:parameter name="depth" value="1000"/>
<map:parameter name="use-request-parameters"
value="true"/>
</map:generate>
<map:transform src="stylesheets/dirzip.xsl"/>
<map:serialize type="zip"/>
</map:match> ================================================
dirzip.xsl is as follows: <?xml version="1.0"?> <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:param name="dirprefix"/>
<xsl:template match="/"> <zip:archive> <xsl:for-each select="//dir:directory"> <xsl:variable name="directoryPath"> <xsl:for-each select="ancestor::*"> <xsl:value-of select="@name"/> <xsl:text>/</xsl:text> </xsl:for-each> </xsl:variable> <xsl:variable name="dirName"> <xsl:value-of select="@name"/> </xsl:variable> <xsl:variable name="DirToBeZipped"><xsl:value-of select="concat($directoryPath,$dirName,'/')"/></xsl:variable> <zip:entry name="{dirName}" src="{$DirToBeZipped}"/> <!-- add code to get the files in each directory --> <xsl:for-each select="./dir:file"> <xsl:variable name="filePath"> <xsl:for-each select="ancestor::*"> <xsl:value-of select="@name"/> <xsl:text>/</xsl:text> </xsl:for-each> </xsl:variable> <xsl:variable name="fileName"> <xsl:value-of select="@name"/> </xsl:variable> <xsl:variable name="fileToBeZipped"><xsl:value-of select="concat($filePath,$fileName)"/></xsl:variable> <zip:entry name="{$fileName}" src="{$fileToBeZipped}"/> </xsl:for-each> <!-- end of code to get files in each directory --> </xsl:for-each> </zip:archive> </xsl:template> </xsl:stylesheet>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
