#1119 Incorrect default type for "let" expressions

Michael Kay

When a "let" expression contains no "as" clause, Saxon initializes the required type to "item()" when it should be "item()". This has few adverse effects because the information is later corrected during the type checking phase. However, there is one situation where a variable reference retains the inferred type "item()" rather than "item()", because the refined type information is not passed on to the variable reference. This is when the variable reference occurs inside an inline function (XPath 3.0 feature only), and the let expression is outside the inline function. This may result in an arbitrary run-time error when the code is executed. A patch is being raised on the 9.3 branch which causes the initial type to be computed correctly. Passing subsequently-refined type information from the variable declaration to the reference is a bit more difficult, and will wait for a subsequent release.


  • Michael Kay

    Michael Kay - 2011-01-19

    Note that this problem only affects XSLT, not XQuery

  • Michael Kay

    Michael Kay - 2011-04-21

    Fixed in