[
https://issues.apache.org/jira/browse/XALANJ-2430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13203327#comment-13203327
]
David Ehrmann commented on XALANJ-2430:
---------------------------------------
I have a possibly related problem. I'm getting this circular reference error
with the following code:
ERROR: 'line 2: Circular variable/parameter reference in '[variable(foo)]'.'
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="foo">
<xsl:variable name="bar" select="/foo/bar/text()" />
<xsl:if test="$bar">baz</xsl:if>
</xsl:variable>
<xsl:template match="/" />
</xsl:stylesheet>
Once I remove the <xsl:if>, the code compiles fine.
This is with the Xalan version that shipped with Java 1.6.0_23, but I think
I've seen it with actual Xalan.
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]