-
Bug
-
Resolution: Unresolved
-
P4
-
9
-
None
-
Fix Understood
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>
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>