#149 Incorrect type for empty variable

v7.6.5
closed
5
2012-10-08
2003-08-05
Michael Kay
No

Saxon incorrectly infers the static type of a variable
with no select attribute and no content (for example,
<xsl:variable name="x"/>). It infers a static type of
document-node() rather than xs:string. This can lead to
a ClassCastException when the variable is used,
especially if it is used incorrectly. For example, a
ClassCastException is thrown if the variable is
processed using <xsl:apply-templates select="$x"/>.

Source code fixed.

Test case added, type909err.

Discussion