A couple of step-by-step debuggers exist for Saxon, in Stylus Studio and oXygen, and they have been written without making modifications to the Saxon source code - though doing it successfully does require rather intensive study of the source code, I suspect. The main interface that's available is the TraceListener. That tells you where you are in the source XSLT or XQuery, and gives you a context value that's your key to navigating into internal data structures.
Michael Kay

From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of designersheep@gmail.com
Sent: 06 June 2007 17:15
To: saxon-help@lists.sourceforge.net
Subject: [saxon] writing step-through debugger in Java using Saxon

I am planning on writing a step-through debugger in Java using Saxon for academic purposes.
Would I need to go directly into and modify the source codes of Saxon? or is there an entry point class somewhere that I am missing?
I do have an alternative idea that I am experimenting at the moment without touching Saxon, if there is no easy way.  Which is creating an alternative XSLT, that calls a Java extension function between every line of the original XSLT to be debugged.  The Java extension function then halts the processing thread every time it is called (or have a halt option for breakpoint effect) and collects line numbers and other information according to variables passed.  Halting seems to be in working order so far, but passing on the resulting tree expression is a pain.
Please let me know if anybody has a better idea or pointers.  Thanks!
Jun Huh
The University of Auckland, New Zealand