Project

Profile

Help

Feature #5082

open

inherit-namespaces="no" not setting xmlns="" (Saxon Bug #4696)

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

Status:
In Progress
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-09-07
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

https://saxonica.plan.io/issues/4696 is reproduced on Saxon-JS 2.3.

$ cat test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="#all" version="3.0" xmlns:x="x"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output indent="yes" />

  <xsl:template as="element(x:description)" name="xsl:initial-template">
    <xsl:element inherit-namespaces="no" name="description" namespace="x">
      <x:scenario>
        <e />
      </x:scenario>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>
$ npx xslt3 -it -xsl:test.xsl
npx: installed 4 in 1.226s
<?xml version="1.0" encoding="UTF-8"?>
<description xmlns="x">
   <x:scenario xmlns:x="x">
      <e/>
   </x:scenario>
</description>
Actions #1

Updated by Michael Kay about 2 years ago

  • Status changed from New to In Progress

Sorry that we let this slip below the radar.

We added test case namespace-0913 in response to the original bug. Saxon-JS isn't running this test; the reason for skipping it is recorded as "Not run because: inherit-namespaces=no is not supported (doesn't work with a DOM)". But I think this might be more of a limitation in the test driver than in the product. I'll investigate further.

Actions #2

Updated by Michael Kay about 2 years ago

I can confirm that inherit-namespaces="no" appears to be unsupported in the SaxonJS runtime. The compiler is generating a SEF file in which the relevant elem instruction has flags="C", and this flag is ignored by the run-time. Whether this is really due to some limitation of the DOM I'm not sure; but in push mode, when writing directly to a serializer, no DOM is involved.

The limitation on inherit-namespaces="no" is documented (see https://www.saxonica.com/saxon-js/documentation2/index.html#!conformance/xslt30) but the explanation given there is a little tame. I don't think the limitation is necessary in the case of the default namespace, which can be undeclared even with the DOM.

Actions #3

Updated by Michael Kay about 2 years ago

  • Tracker changed from Bug to Feature

Reclassifying this as an enhancement request; the code is behaving as designed and the restriction is documented.

Implementing inherit-namespaces="no", even for the default namespace only, is complex and potentially disruptive because it requires additional state to be maintained in the push pipeline. I'm therefore not going to attempt it as a patch. Although it's a conformance issue, I'm not sure it deserves a very high priority; in the absence of support for Namespaces 1.1, I don't think this XSLT construct has much value.

Please register to edit this issue

Also available in: Atom PDF Tracking page