Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8172974

[JAXP] XALAN: Wrong result when transforming namespace unaware StAX Input

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • xml
    • None

      Transformation of namespace unaware StAX input leads to a wrong result.

      This is the example to reproduce:

      Source:
      =======
      <?xml version="1.0"?>
      <envelope xmlns="http://www.sap.com/myns" xmlns:sap="http://www.sap.com/myns">
        <sap:row sap:attrib="a">1</sap:row>
        <row attrib="b">2</row>
        <row sap:attrib="c">3</row>
      </envelope>

      Stylesheet:
      ===========
      <?xml version="1.0"?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:template match="/">
          <xsl:variable name="Counter" select="count(//row)"/>
          <xsl:variable name="AttribCounter" select="count(//@attrib)"/>
          <Counter><xsl:value-of select="$Counter"/></Counter>
          <AttribCounter><xsl:value-of select="$AttribCounter"/></AttribCounter>
        </xsl:template>
      </xsl:stylesheet>

      Expected result of transformation without namespace support:
      ===================================================================
      <?xml version="1.0" encoding="UTF-8"?><Counter>3</Counter><AttribCounter>3</AttribCounter>

      Actual result of transformation of StAX source without namespace support:
      ===================================================================
      <?xml version="1.0" encoding="UTF-8"?><Counter>2</Counter><AttribCounter>3</AttribCounter>

            clanger Christoph Langer
            clanger Christoph Langer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: