You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Henry Zongaro (JIRA)" <xa...@xml.apache.org> on 2008/02/01 15:29:16 UTC
[jira] Commented: (XALANJ-2430) Circular variable/parameter
reference if recursive template is used in global variable
[ https://issues.apache.org/jira/browse/XALANJ-2430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564778#action_12564778 ]
Henry Zongaro commented on XALANJ-2430:
---------------------------------------
It looks like the problem is caused by the definition and reference to a local variable within the top-level variable definition. I have reduced the sample stylesheet to the following:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:variable name='countInfo'>
<xsl:variable name='someElement'/>
<xsl:value-of select='$someElement'/>
</xsl:variable>
<xsl:template match='/'>
<out><xsl:value-of select='$countInfo'/></out>
</xsl:template>
</xsl:stylesheet>
I think this problem was caused by the fix to XALANJ-2108.
> Circular variable/parameter reference if recursive template is used in global variable
> --------------------------------------------------------------------------------------
>
> Key: XALANJ-2430
> URL: https://issues.apache.org/jira/browse/XALANJ-2430
> Project: XalanJ2
> Issue Type: Bug
> Components: XSLTC
> Affects Versions: 2.7.1
> Environment: Ubuntu 7.10, java-1.5.0-sun-1.5.0.13, Xalan 2.7.1, Xerces 2.9.0 (from Xalan package)
> Reporter: Auke Schrijnen
>
> Xalan 2.7.1 won't compile an xslt when a recursive template is used in a global variable. This works in Xalan 2.7.0!
> 2.7.1 throws a TransformerException: Circular variable/parameter reference in '[variable(countInfo)]'.
> Example:
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
> <xsl:template name='countRecursive'>
> <xsl:param name='info'/>
> <xsl:param name='count' select='"1"'/>
> <xsl:choose>
> <xsl:when test='$info != "" and number($count) < 4'>
> <xsl:call-template name='countRecursive'>
> <xsl:with-param name='info' select='substring-after($info, " ")'/>
> <xsl:with-param name='count' select='$count + 1'/>
> </xsl:call-template>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select='$count'/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> <xsl:variable name='countInfo'>
> <xsl:variable name='someElement'>
> <xsl:value-of select='/root/vars'/>
> </xsl:variable>
> <xsl:call-template name='countRecursive'>
> <xsl:with-param name='info' select='$someElement'/>
> </xsl:call-template>
> </xsl:variable>
> <xsl:template match='/'>
> <xsl:element name='count'>
> <xsl:value-of select='$countInfo'/>
> </xsl:element>
> </xsl:template>
> </xsl:stylesheet>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org