Feature #5082
openinherit-namespaces="no" not setting xmlns="" (Saxon Bug #4696)
0%
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>
Updated by Michael Kay over 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.
Updated by Michael Kay over 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.
Updated by Michael Kay over 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