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

Global variable values lost after call using call-template

           Summary: Global variable values lost after call using call-
                    template
           Product: XalanJ2
           Version: 2.3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If I define a global variable using <xsl:text> to specify the variable, the 
value is lost after an initial template invocation via <xsl:call-template>.

This problem occurs with xalan 2.3.1 but does not occur with xalan 2.2.  It 
doesn't occur if the variable is defined without <xsl:text> and it also doesn't 
occur if the template is accessed via <xsl:apply-templates> rather than an 
explicit invocation.

Here is an input xml file and stylesheet that duplicate the problem.  The 
problem occurs for global variable GLOBAL1 but not for GLOBAL2.

<?xml version="1.0"?>
<root>
<elem>elem 1 value</elem>
<elem>elem 2 value</elem>
</root>


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html"/>

<xsl:variable name="GLOBAL1">
        <xsl:text>global1</xsl:text>
</xsl:variable>

<xsl:variable name="GLOBAL2">global2</xsl:variable>

<xsl:template match="/">

        <HTML>
                <HEAD>
                        <TITLE>Test</TITLE>
                </HEAD>
                <BODY>
                        <xsl:for-each select="child::root/elem">
                                <xsl:call-template name="test_template"/>
                        </xsl:for-each>
                </BODY>
        </HTML>
</xsl:template>

<xsl:template name="test_template">
        <BR>global variables in call-template</BR>
        GLOBAL1:<xsl:copy-of select="$GLOBAL1"/>
        GLOBAL2:<xsl:copy-of select="$GLOBAL2"/>
</xsl:template>

</xsl:stylesheet>

Reply via email to