DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25453>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25453 Redirect does not append to file [EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Additional Comments From [EMAIL PROTECTED] 2004-02-19 17:37 ------- There are a few problems with your stylesheet. When I run similar transformations to this one an output file named "$outputfile" is created. I think you want the output file named "doc3.out". So the first problem is that your variable should be defined like this: <xsl:variable name="outputfile" select="'doc3.out'"/> Note the extra single-quotes inside the double-quotes The element <redirect:close file="$outputfile"/> is not inside of any <template> element, this is wrong, it can not be a top level element like this (Xaalan should have complained about this). Also the variable outputfile is not in scope for this <redirect:close>. I didn't look at what happens underneath it all, but I'd guess that you may be trying to open the same file multiple times all with an append mode and only one of those should succeed. I think the <xsl:close> element should be inserted at the correct depth and location corresponding to the <redirect:open>. If you open in append mode, write, then close things should be better for the next cycle of open in append mode,write,close. Because your <xsl:close> is in the wrong place some buffers seem to not be flushed and the output never makes it to the file system. Here is a re-work of your sample XSL using your input XML that works for me: --------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect"> <xsl:template match="/"> <out> default output <xsl:apply-templates/> </out> </xsl:template> <xsl:template match="/address_object/address"> <xsl:for-each select="/address_object/address"> <xsl:variable name="outputfile" select="'doc34.out'" /> <redirect:open file="{$outputfile}" append="yes" /> <redirect:write file="{$outputfile}" append="yes" > <address> <xsl:apply-templates/> </address> </redirect:write> <redirect:close file="{$outputfile}"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> --------------------------------------- Regards, Brian Minchau
