You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/10/17 03:35:40 UTC

DO NOT REPLY [Bug 4218] New: - call-template within xsl:with-param template screws up variables!!

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

call-template within xsl:with-param template screws up variables!!

           Summary: call-template within xsl:with-param template screws up
                    variables!!
           Product: XalanJ2
           Version: CurrentCVS
          Platform: PC
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: scott_boag@lotus.com


The following stylesheet puts out <out>abcabc</out>, which is absolutely 
incorrect.  If you uncomment the commented value-of and variable, it results 
"Variable accessed before it is bound!" error message.  The bug seems to be 
related to the inner call-template... it looks like something in the stack 
frame is not being restored???

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:template match="/">
    <out>
      <xsl:variable name="v1" select="'abc'"/>
      <xsl:variable name="v2" select="'def'"/>
      
      <!-- Comment this in, along with the value-of below, 
           to get error message: Variable accessed before it is bound! -->
      <!-- xsl:variable name="v3" select="'ghi'"/ -->
      
      <xsl:call-template name="test-template">
        <xsl:with-param name="p1">
          <xsl:call-template name="xyz-template">
            <xsl:with-param name="p1" select="$v1"/>
          </xsl:call-template>
          <xsl:value-of select="$v2"/>
          <!-- Comment this in along with the v3 variable above to
               get error message!  -->
          <!-- xsl:value-of select="$v3"/ -->
        </xsl:with-param> 
      </xsl:call-template>
    </out>
  </xsl:template>
  
  <xsl:template name="test-template">
    <xsl:param name="p1" select="'error'"/>
    <xsl:value-of select="$p1"/>
  </xsl:template>
  
  <xsl:template name="xyz-template">
    <xsl:param name="p1" select="'error'"/>
    <xsl:value-of select="$p1"/>
  </xsl:template>
  
</xsl:stylesheet>