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=6667>.
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=6667

Corruption when writing to multiple files

           Summary: Corruption when writing to multiple files
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.lib.Redirect
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following XSLT code is supposed to create 2 small files and write the same 
value to both but under version 2.3.1 it writes incorrect data to one of the 
files.

---- XSLT (test.xsl) ----
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0" 
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"      extension-
element-prefixes="redirect" >


<xsl:variable name="a"><xsl:value-of select="//Test/@a"/>x</xsl:variable>
<xsl:variable name="b" select="//Test/@b"/>


<xsl:template match="/">                

                <redirect:open file="1.txt"/>

                                <xsl:call-template name="writeTo1"/>

                                <xsl:call-template name="doNothing">
                                        <xsl:with-param name="dummy">
                                                <xsl:value-of select="$b"/>y
                                        </xsl:with-param>
                                </xsl:call-template>

                                <redirect:write file="2.txt">
                                        <xsl:value-of select="$a"/>
                                </redirect:write>

                <redirect:close file="1.txt"/>
                
</xsl:template>


<xsl:template name="writeTo1">
        <redirect:write file="1.txt">
                <xsl:value-of select="$a"/>
        </redirect:write>
</xsl:template>


<xsl:template name="doNothing">
        <xsl:param name="dummy"/>
</xsl:template>
        
</xsl:stylesheet>
---- XML (test.xml) ----
<?xml version="1.0"?>
<?okt-xsl-stylesheet type="text/xsl" href="test.xsl" formatter="text"?>

<Test a="right" b="wrong"/>
------------------------

It should write the value "rightx" to both files but it writes "wrongy" to file 
1 which is the value passed to a dummy template which does nothing.

I can't remove any of the following:
- the dummy template
- the writeTo1 template (if I put the code in directly instead then it works)
- the "x" character appended to the end of veriable a
- the "y" character appended to the end of the value passed to the dummy 
template

This example works fine under version 2.2

Damon

Reply via email to