Bug #4681
closednamespace declaration not honored: error XTDE1390 undeclared prefix: saxon
100%
Description
When I run the file
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:output method="text"/>
<xsl:template name="xsl:initial-template">
<xsl:text xmlns:saxon="http://saxon.sf.net/">Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('saxon:platform')}</xsl:text>
</xsl:template>
</xsl:stylesheet>
with Saxon-JS 2 under Node (using xslt3 -it -xsl
) I get an error:
Transformation failure: Error XTDE1390 at ns-problem2.xsl#10
Undeclared prefix: saxon
Transformation failed: Error XTDE1390 at ns-problem2.xsl#10
Undeclared prefix: saxon
The namespace is declared on the xsl:text
element so I think this is a bug. Running the stylesheet through Saxon HE 10.1 Java does not give any error.
Moving the namespace declaration to the stylesheet's root element enables Saxon-JS to run the code but I think it should work with the local namespace declaration as well.
Updated by Michael Kay over 4 years ago
- Status changed from New to In Progress
Added XSLT3 test case system-property-025, which adapts the repro by binding a different prefix locally to the XSLT namespace.
Updated by Michael Kay over 4 years ago
Confirmed that the new test is failing under latest Saxon-JS build.
Updated by Michael Kay over 4 years ago
In the SEF file, the call on system-property
is output with
"ns": "= xml=~ fn=~ xsl=~ xs=~ ",
indicating that the namespace declaration on the xsl:text element has been lost.
Updated by Michael Kay over 4 years ago
In the static phase (static.xsl#702) an xsl:text
element is replaced by its content, which loses the namespace declarations. It also probably loses other attributes that might affect the interpretation of TVTs within the xsl:text
element, for example @version
or @default-collation
.
Updated by Michael Kay over 4 years ago
First attempt to fix this by passing the xsl:text through to the next phase using xsl:next-match
, and picking it up in the sef phase along with xsl:value-of
at creating-new-nodes#279 was unsuccessful.
(Trying to remember how to debug the compiler, haven't done it for a while...)
Updated by Michael Kay over 4 years ago
Now working (though I need to do some clearing up before committing, to get rid of temporary diagnostics, and to do some regression testing).
The changes to the XX compiler are:
-
In
static.xsl
, in thematch="xsl:text"
template, callxsl:next-match
so thexsl:text
element survives into themode="sef"
phase. -
In
creating-new-nodes.xsl
, in thematch="xsl:text[normalize-space()]"
template, apply-templates with modeattribute-sans-prefix
to process attributes appearing on thexsl:text
element.
Updated by Michael Kay over 4 years ago
- Status changed from In Progress to Resolved
- Priority changed from Low to Normal
- Fix Committed on JS Branch Trunk added
Updated by Debbie Lockett over 4 years ago
- Status changed from Resolved to In Progress
Reopening because I'm seeing regression. E.g. xslt30 axes test set. Reverting the change in static.xsl for the match="xsl:text"
template, means the axes tests pass again, but t=system-property-025 fails.
Updated by Norm Tovey-Walsh almost 4 years ago
- Status changed from In Progress to Resolved
The tests are passing again, apparently it was something else.
Updated by Community Admin almost 4 years ago
- Applies to JS Branch 2 added
- Applies to JS Branch deleted (
2.0)
Updated by Debbie Lockett almost 4 years ago
- Fix Committed on JS Branch 2 added
- Fix Committed on JS Branch deleted (
Trunk)
Updated by Debbie Lockett almost 4 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in JS Release set to Saxon-JS 2.1
Bug fix applied in the Saxon-JS 2.1 maintenance release.
Please register to edit this issue
Also available in: Atom PDF Tracking page