Project

Profile

Help

Abort a running transformation?

Added by Dieter Stüken almost 12 years ago

Hi there,

I wrote a little GUI tool for running a transformation. My XsltTransformer is running in a separate thread.

If I get tired of waiting for the result, or a broken transformation indeed run into an infinite loop, I like to push a STOP button to interrupt the currently running transformation.

My solution is to install some breaking TraceListener which get called and simply throws an Exception. I discovered a TerminationException, which seemed to be a good choice to me. Unfortunately the TraceListener methods are not allowed to throw any checked exception. Thus I used a RuntimeException instead.

Is there any better solution? I think implementers of any XSLT debugger may have a similar problem...

Dieter.


Replies (1)

RE: Abort a running transformation? - Added by Michael Kay almost 12 years ago

First, please note, we're trying to encourage people to move over to the forums at http://saxonica.plan.io.

In 9.4 there's a much more general mechanism than the TraceListener: you can supply a CodeInjector which injects any code you like into the expression tree anywhere that you like. So you could for example inject code at every function or template call to check for this "abort" signal.

Of course both your proposal and this alternative have the disadvantage that with a pathological path expression such as .///following::/preceding::*, there may be long periods of execution with no trace calls executed.

    (1-1/1)

    Please register to reply