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

           Summary: Redirect does not append to file
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.lib.Redirect
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have tried several permutations in opening a file and appending to it.

The program below cannot append data to a file it overwrites it or doesn't do
anything.

<?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="doc3.out"/>
                <redirect:open file="$outputfile"/> <!-- if append here then           
      
 Invocation target Exception-->
                <redirect:write file="$outputfile" append="true"> 
                        <address>
                                <xsl:apply-templates/>
                        </address>
                </redirect:write>                       
             
             </xsl:for-each>
        </xsl:template>
        <redirect:close file="$outputfile"/>
</xsl:stylesheet>

I have read the documentation but can't seem to get it working. What i'm trying
to is open an XML file. Like this
<?xml version="1.0" encoding="UTF-8"?>
<address_object>
        <address>
                <name>John</name>
                <street>1925 Fire street</street>
                <city>Chicago</city>
                <zip>34928</zip>
        </address>
        <address>
                <name>Steve</name>
                <street>1926 Red Rd.</street>
                <city>Peoria</city>
                <zip>34222</zip>
        </address>
        <address>
                <name>Grant</name>
                <street>1927 Forest Ave.</street>
                <city>Des Moines</city>
                <zip>30857</zip>
        </address>
</address_object>

and then read each tag, and append it to a file, until last tag. I know this can
be done in an easier way but I am actually implementing something more difficult
and need to do it this way.

Reply via email to