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

normalize-space gives StackOverflowError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 2.4
    • None
    • Xalan
    • None
    • winXP, java 1.4.2_03, xalan 2.4.1
    • fp3

    Description

      With the following xml file:

      <?xml version = "1.0" encoding = "UTF-8"?>
      <a>
      <l>
      25</l>
      <b>
      <l>
      25</l>
      <p>
      123</p>
      </b>
      <b>
      <l>
      50</l>
      <p>
      567</p>
      </b>
      </a>

      and the following stylesheet:

      <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:fo="http://www.w3.org/1999/XSL/Format">

      <xsl:template match="/">
      <xsl:apply-templates/>
      </xsl:template>

      <xsl:template match="a">
      <xsl:apply-templates select = "b"/>
      </xsl:template>

      <xsl:template match="b">
      <xsl:apply-templates select = "p"/>
      </xsl:template>

      <xsl:template match = "p">
      <xsl:if test = "normalize-space(../l) = normalize-space(/a/l)">success</xsl:if>
      </xsl:template>

      <xsl:template match = "*"/>

      </xsl:stylesheet>

      the following error is produced:

      (Location of error unknown)XSLT Error (java.lang.StackOverflowError): null

      The following xml files do not cause the error to manifest:

      <?xml version = "1.0" encoding = "UTF-8"?>
      <a>
      <l>25</l>
      <b>
      <l>
      25</l>
      <p>
      123</p>
      </b>
      <b>
      <l>
      50</l>
      <p>
      567</p>
      </b>
      </a>

      <?xml version = "1.0" encoding = "UTF-8"?>
      <a>
      <l>
      25</l>
      <b>
      <l>25</l>
      <p>
      123</p>
      </b>
      <b>
      <l>50</l>
      <p>
      567</p>
      </b>
      </a>

      Suggesting that it only occurs when the content of at least one matched node on both sides of the equality test begins with a newline per run.

      Attachments

        1. patch.j2001.txt
          0.8 kB
          Henry Zongaro

        Issue Links

          Activity

            People

              zongaro@ca.ibm.com Henry Zongaro
              ptreadaway Paul Treadaway
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: