Bug #3242
closedStatic type checking error with document-node()
100%
Description
I'm getting a static type checking error when testing on whether a variable of type item() is an element() or document-node() in the same expression. The error can be avoid if I do the tests in separate expressions. I've attached some toy stylesheets that demonstrate the error that have been distilled out of a more complex meta-xsl generated stylesheet.
The error I'm getting is:
Static error at char 1 in xsl:copy-of/@select on line 19 column 62 of bug.instance-of-document-node.xsl:
XPTY0004: Required item type of value of variable $ns-cleaned is node(); supplied value has item type xs:string
The relevant portion from the bug stylesheet is:
@
<xsl:when test="(. instance of element()) or (. instance of document-node())">
<xsl:variable name="ns-cleaned" as="item()*">
<xsl:copy-of select="." copy-namespaces="no"/>
</xsl:variable>
<xsl:sequence select="serialize($ns-cleaned)"/>
</xsl:when>
@
If that "or" is split into two different "whens" as in the workaround stylesheet no error is generated.
This problem only seems to be present in Saxon 9.7, I did not get any errors from 9.5. or 9.6.
Files
Please register to edit this issue