I've run into a "Variable accessed before it is bound!" exception. This occurs 
on a current build from CVS. Attached is
a test case. As far as I can tell this is permissible XSL, besides, it worked 
OK on xalan-j-2_0_1. From my debugging so
far it has something to do with the VariableStack getting out of sync and/or 
lazy evaluation failing for the
apply-templates as the content of a with-param. Hopefully I'll be able to debug 
it and describe a fix. If someone else
is working on it, I'd be happy to work around it because I'm also trying solve 
a transformer reuse problem.

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

  <!-- FileName: variablexx -->
  <!-- Document: http://www.w3.org/TR/xslt -->
  <!-- DocVersion: 19991116 -->
  <!-- Purpose: Test for nested variables with apply-templates as content of with-param.  -->
  <!-- Author: Frank Weiss  [EMAIL PROTECTED] -->


	<xsl:template match="/root">
		<xsl:for-each select="child">
			<xsl:variable name="first" select="'1st'"/>
			<xsl:variable name="second" select="'2nd'"/>
			<xsl:call-template name="zoom">
				<xsl:with-param name="alpha"><xsl:apply-templates select="zcaption"/></xsl:with-param>
				<xsl:with-param name="beta"><xsl:value-of select="$second"/></xsl:with-param>
			</xsl:call-template>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="zcaption">
		<xsl:variable name="name" select="'z'"/>
	</xsl:template>

	<xsl:template name="zoom">
		<xsl:param name="alpha"/>
		<xsl:param name="beta"/>
	</xsl:template>

</xsl:stylesheet>
<?xml version="1.0"?>
<root>
	<child>one<zcaption src="01"/></child>
	<child>two<zcaption src="02"/></child>
	<child>three<zcaption src="03"/></child>
	<child>four<zcaption src="04"/></child>
</root>

Reply via email to