[ 
https://issues.apache.org/jira/browse/XALANJ-2430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565342#action_12565342
 ] 

Auke Schrijnen commented on XALANJ-2430:
----------------------------------------

The workaround works, but isn't always possible (some local variables are 
declared in for-each loops)

> 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) &lt; 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to