Local variable used in a pattern
- Internal Saxon error: local variable encountered whose binding has been deleted
occurs when a local variable is used in a pattern (e.g. a count pattern in xsl:number) and this is the only reference to that variable. For example
<xsl:variable name="href" select="..." as="xs:string"/>
from="*[contains(@class,' map/map ')]"
Reported today by Toshihiko Makita on saxon-help mailing list
#1 Updated by Michael Kay almost 3 years ago
There are actually two bugs.
(a) the reference to the variable is not identified as a "looping reference", which means that the compiler attempts to inline the variable. It should not do this, because the value of the variable (as it appears in a predicate) is used repeatedly
(b) the inlining of the variable is not correctly implemented for a variable reference within a pattern; the declaration of the variable is removed from the expression tree, but the reference to the variable remains.
Patches for both problems are being committed to the 9.5 (and 9.6) branches.