Bug #6600
opencurrent function wrongly allowed in pattern
0%
Description
According to https://www.w3.org/TR/xslt-10/#function-current
It is an error to use the current function in a pattern.
But Saxon-JS 2.7.0 compiles the following XSLT 1.0 stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="a[.=current()]"/>
</xsl:stylesheet>
It seems that this pattern is effectively treated like the vacuous condition in a[.=.]
, but a "Static error in pattern" would be preferable.
Updated by Michael Kay 3 days ago
SaxonJS provides an XSLT 3.0 processor that supports XSLT 1.0 backwards compatibility mode.
The fact that something is an error in 1.0 does not make it an error when running 3.0-in-1.0-compatibility-mode.
The semantics of a[.=current()]
are well defined in 3.0 (in fact, in 2.0); as you say, the predicate is vacuous. This would not be the case if you wrote, for example
match="a[../@class=current()/@class]"
which would match any a
element having the same @class
as its parent. Or for something that it's hard to do without current()
:
match="a[@class=current()/@class]//b"
which matches any b
element that has an ancestor a
element with a matching @class
attribute. (current()
in a pattern always refers to the node you are trying to match)`
Please register to edit this issue
Also available in: Atom PDF Tracking page