Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2430

Circular variable/parameter reference if recursive template is used in global variable

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.7.1
    • Fix Version/s: None
    • Component/s: XSLTC
    • Labels:
      None
    • Environment:
      Ubuntu 7.10, java-1.5.0-sun-1.5.0.13, Xalan 2.7.1, Xerces 2.9.0 (from Xalan package)

      Description

      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>

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              auke Auke Schrijnen
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: