Project

Profile

Help

Bug #4660

Incorrect xpath-default-namespace on included files with XX compiler

Added by John Lumley 12 months ago. Updated 5 months ago.

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

100%

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

Description

In the case where an included stylesheet has an @xpath-default-namespace on the stylesheet|transform element, and the top-level stylesheet does not, templates within the included stylesheet, which do not themselves have @xpath-default-namespace attributes, do not inherit the property from their parent.

Minimal reproduction of the problem attached.

bugXXX.xsl (468 Bytes) bugXXX.xsl John Lumley, 2020-07-31 12:02
bugXXXinc.xsl (380 Bytes) bugXXXinc.xsl John Lumley, 2020-07-31 12:02

History

#1 Updated by John Lumley 12 months ago

It appears to be an error in the static phase, as the result after static processing is:

<xsl:stylesheet xmlns:ex="http://ns.saxonica.com/xslt/export" xmlns:math="http://www.w3.org/2005/xpath-functions/math"
      xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="FOO" 
     version="3.0" ex:ns="xml=~ xsl=~ xs=~ math=~ =FOO">
   <xsl:template ex:ns="xml=~ xsl=~ xs=~ math=~ =FOO" ex:baseUri="http://localhost/XSLT3/special/bugXXXinc.xsl"
            ex:precLabel="A" ex:lineNr="2" match="a">
      <A ex:lineNr="3" ex:exclude="http://www.w3.org/2001/XMLSchema http://www.w3.org/2005/xpath-functions/math"/>
   </xsl:template>
   <xsl:template ex:ns="xml=~ xsl=~ xs=~ math=~ =FOO" ex:baseUri="http://localhost/XSLT3/special/bugXXX.xsl" 
        ex:precLabel="A" ex:lineNr="3" match="b" xpath-default-namespace="FOO">
      <B ex:lineNr="4" ex:exclude="http://www.w3.org/2001/XMLSchema http://www.w3.org/2005/xpath-functions/math"/>
   </xsl:template>
</xsl:stylesheet>

where the template matching b does not have an inherited @xpath-default-namespace from its original parent.

#2 Updated by Debbie Lockett 10 months ago

  • Assignee set to Michael Kay

#3 Updated by Michael Kay 10 months ago

  • Category set to XSLT Conformance
  • Status changed from New to In Progress

I have created xslt3 test case xpath-default-namespace-1202 and have confirmed that it succeeds under Saxon-J and fails under -JS.

#4 Updated by Michael Kay 10 months ago

It seems that it can be fixed by adding

<xsl:apply-templates select="../@xpath-default-namespace" mode="#current"/>

at static.xsl#938. At this point we're processing a top-level component and we're about to process its own attributes; this processes the xpath-default-namespace attribute on the parent element first. I do wonder if there are other attributes that should receive the same treatment: the ones to look at are

default-collation, default-mode, default-validation, exclude-result-prefixes, expand-text, extension-element-prefixes, use-when, version.

I'll think about adding tests for some of these.

#5 Updated by Michael Kay 10 months ago

Added tests for expand-text on an included module (cvt-046, cvt-047). The tests pass on both Saxon-J and Saxon-JS -- though it looks to be a case that was definitely untested before.

default-mode seems to be covered by test mode-1617.

Added tests collations-0126 and collations-0127 to test default-collation at xsl:stylesheet level. These tests are failing on Saxon-JS, along with many other collation tests, but that's within the scope of bug #4616.

#6 Updated by Michael Kay 10 months ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch Trunk added

#7 Updated by Community Admin 6 months ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0, Trunk)

#8 Updated by Debbie Lockett 6 months ago

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

#9 Updated by Debbie Lockett 5 months 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