Donate Share

Saxon XSLT and XQuery Processor

Tracker: Bugs

5 Tail call bug in apply-templates - ID: 770785
Last Update: Settings changed ( mhkay )

When a call on apply-templates is the last thing to
happen in a template, tail call optimization kicks in -
the call is performed after the containing template
returns to its caller, reducing the number of calls on
the stack. But when the select expression of the
apply-templates call contains references to variables
(or possibly other aspects of the context such as
position()) then the context information isn't being
saved properly.

The effect is unpredictable, it might be a Java error
such as a NullPointerException or ClassCastException,
or it might be other spurious errors or simply wrong
results.

The workaround is to insert <xsl:value-of select="''"/>
(outputting an empty string) after the tail call of
apply-templates, to stop tail call optimization happening.

Reported by Craeg K Strong [cstrong (at)
arielpartners.com].

Not yet fixed. The two possible fixes are to save the
context properly, or to suppress tail call optimization
in this situation.


Michael Kay ( mhkay ) - 2003-07-14 04:49

5

Closed

Fixed

Michael Kay

XSLT conformance

v7.6.5

Public


Comments

No follow-up comments have been posted.

Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
close_date - 2003-10-06 16:08 mhkay
resolution_id None 2003-10-06 16:08 mhkay
status_id Open 2003-10-06 16:08 mhkay