Project

Profile

Help

Bug #4681

closed

namespace declaration not honored: error XTDE1390 undeclared prefix: saxon

Added by Martin Honnen over 4 years ago. Updated over 3 years ago.

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

100%

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

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.

Actions #1

Updated by Debbie Lockett about 4 years ago

  • Assignee set to Michael Kay
Actions #2

Updated by Michael Kay about 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.

Actions #3

Updated by Michael Kay about 4 years ago

Confirmed that the new test is failing under latest Saxon-JS build.

Actions #4

Updated by Michael Kay about 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.

Actions #5

Updated by Michael Kay about 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.

Actions #6

Updated by Michael Kay about 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...)

Actions #7

Updated by Michael Kay about 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 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.

Actions #8

Updated by Michael Kay about 4 years ago

  • Status changed from In Progress to Resolved
  • Priority changed from Low to Normal
  • Fix Committed on JS Branch Trunk added
Actions #9

Updated by Debbie Lockett about 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.

Actions #10

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.

Actions #11

Updated by Community Admin almost 4 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #12

Updated by Debbie Lockett almost 4 years ago

  • Fix Committed on JS Branch 2 added
  • Fix Committed on JS Branch deleted (Trunk)
Actions #13

Updated by Debbie Lockett over 3 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