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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: xml
    • Labels:
      None

      Description

      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>

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: