Incorrect xpath-default-namespace on included files with XX compiler
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.
#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.
#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
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
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.
Please register to edit this issue