Project

Profile

Help

Bug #4666

closed

Different xmlns (Saxon 10.1 and 9.9)

Added by Air Quick over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2020-08-03
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:
Platforms:

Description

Given these files, Saxon 10.1 behaves differently from 9.9.

$ cat source.xml 
<?xml version="1.0" encoding="UTF-8"?>
<p><q/></p>
$ cat stylesheet.xsl 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:w="w-uri" xmlns:x="x-uri"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output indent="yes" omit-xml-declaration="yes" />

  <xsl:mode on-multiple-match="fail" on-no-match="shallow-copy" />

  <xsl:template as="element(x:report)" match="/">
    <xsl:message select="('xsl:product-name', 'xsl:product-version') ! system-property(.)" />

    <xsl:variable as="element(p)" name="var">
      <xsl:apply-templates />
    </xsl:variable>

    <xsl:element name="report" namespace="x-uri">
      <xsl:sequence select="$var" />
    </xsl:element>
  </xsl:template>

  <xsl:template as="element(w:s)" match="q">
    <xsl:element name="w:s" namespace="w-uri" />
  </xsl:template>

</xsl:stylesheet>
$ java -jar SaxonHE10-1J/saxon-he-10.1.jar -s:source.xml -xsl:stylesheet.xsl
SAXON HE 10.1
<report xmlns="x-uri">
   <p xmlns="">
      <w:s xmlns="x-uri" xmlns:w="w-uri"/>
   </p>
</report>
$ java -jar SaxonHE9-9-1-7J/saxon9he.jar -s:source.xml -xsl:stylesheet.xsl
SAXON HE 9.9.1.7
<report xmlns="x-uri">
   <p xmlns="">
      <w:s xmlns:w="w-uri"/>
   </p>
</report>

10.1 puts xmlns="x-uri" in <w:s>, whereas 9.9 doesn't. I wonder which is correct.

Actions #1

Updated by Michael Kay over 4 years ago

  • Tracker changed from Support to Bug
  • Assignee set to Michael Kay

10.1 looks wrong to me. The rules for Constructing Complex Content (ยง5.7.1, rule 13) say that namespaces are copied to descendant elements "unless that element or an intermediate element already has a namespace node with the same name (or absence of a name) or that descendant element or an intermediate element is in no namespace and the namespace node has no name."

Actions #2

Updated by Michael Kay over 4 years ago

  • Category set to XSLT conformance
  • Priority changed from Low to Normal

Reproduced as XSLT3 test case namespace-0912

Actions #3

Updated by Michael Kay over 4 years ago

  • Status changed from New to Resolved
  • Applies to branch 10, trunk added
  • Fix Committed on Branch 10, trunk added

Fixed in ComplexContentOutputter.startElement: when handling namespace inheritance for the p element, inheritance of the default namespace binding is suppressed not just for the current element but also for its descendants.

Actions #4

Updated by O'Neil Delpratt about 4 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.2 added

Bug fix applied in the Saxon 10.2 maintenance release.

Actions #5

Updated by O'Neil Delpratt about 4 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF