Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-416

Wrong access to out-of-scope xsl:variable not detected in certain circumstances

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.7
    • None
    • XalanC
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 29079

    Description

      In the following very short stylesheet,
      Template2 is refering to variable 'OutOfScope'
      which is declared locally within Template1, not Template2.
      This error goes undetected by XalanC version 1.7.0.
      Note that if the declaration of variable "result"
      surrounding the call to Template2 is removed,
      that is, Template2 is called directly within Template1,
      then Xalan complains that variable 'OutOfScope' is not defined.

      <?xml version="1.0" encoding = "ISO-8859-1"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      <xsl:template name="Template1" match="/">
      <xsl:variable name="OutOfScope" select="."/>
      <xsl:variable name="result">
      <xsl:call-template name="Template2"/>
      </xsl:variable>
      <xsl:copy-of select="$result"/>
      </xsl:template>

      <xsl:template name="Template2">
      <xsl:copy-of select="$OutOfScope"/><!-- ALG: This variable should not be
      visible, should it? -->
      </xsl:template>

      </xsl:stylesheet>

      Attachments

        Activity

          People

            Unassigned Unassigned
            aleguenn@free.fr Alain Le Guennec
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: