The optimization of tail calls introduced in Saxon 7.5
fails in two particular circumstances: the effect is
that a tail call of xsl:call-template or
xsl:apply-templates is simply not executed, so there is
output missing from the result tree.
One situation is where the tail call occurs in an
xsl:matching-substring or xsl:non-matching-substring
Another is where the tail call occurs in a template
that is invoked by a built-in template.
A tail call is an xsl:apply-templates or
xsl:call-template instruction that is the last thing a
template does. A circumvention is to add <xsl:value-of
select="''"/> after the tail call.
Applies to Saxon 7.5 only; source code fixed (at least
for the above two cases).