Bug #4681
closed
namespace declaration not honored: error XTDE1390 undeclared prefix: saxon
Category:
XSLT Conformance
Fix Committed on JS Branch:
2
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.
- Assignee set to Michael Kay
- 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.
Confirmed that the new test is failing under latest Saxon-JS build.
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.
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
.
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...)
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 the match="xsl:text"
template, call xsl:next-match
so the xsl:text
element survives into the mode="sef"
phase.
-
In creating-new-nodes.xsl
, in the match="xsl:text[normalize-space()]"
template, apply-templates with mode attribute-sans-prefix
to process attributes appearing on the xsl:text
element.
- Status changed from In Progress to Resolved
- Priority changed from Low to Normal
- Fix Committed on JS Branch Trunk added
- 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.
- Status changed from In Progress to Resolved
The tests are passing again, apparently it was something else.
- Applies to JS Branch 2 added
- Applies to JS Branch deleted (
2.0)
- Fix Committed on JS Branch 2 added
- Fix Committed on JS Branch deleted (
Trunk)
- 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