Page 1 of 1

debugger missing empty templates

Posted: Thu Oct 05, 2017 3:30 pm
by xmlhelpline
our team is working on lots of XSLT templates and using the debugger frequently. We frequently pick up code created by other users.

In working with the debugger if you encounter a template that does nothing, the debugger will not be able to "step through" it. It simply skips over it (even though it is actually processed).

We have elements that may initially have no target mapping. So an element template for it is initially empty. Later, a mapping is found and we need to change it so that the template provides target output.

Take a template like this:
<xsl:template match="someElement"/>

It provides no target output. It absolutely is fired in the processing.
You can do a full stack trace to find that this template actually fired. However, if you step through the templates in the Oxygen debugger you will never see that this template was actually fired. It simply skips over it and moves on to the next template. Even if you set break points and "step" one step at a time.

So we are having to do a maddening analysis of "which of hundreds of templates is empty and needs to be changed with target output". And oxygen is no help.

submitted respectfully. We love the debugger.

Re: debugger missing empty templates

Posted: Thu Oct 05, 2017 4:31 pm
by gravyboat
This has been a source of frustration for me as well; I've worked around it by adding content to the template, i.e.,

<xsl:template match="someElement">
<xsl:comment>empty template</xsl:comment>

In order to step through in debugger, but it would be nice if it could stop on empty templates.

Re: debugger missing empty templates

Posted: Thu Oct 05, 2017 5:05 pm
by adrian

Thank you for the feedback.

I've submitted an issue to investigate if this can be improved. Note that this may very well depend on the capabilities of the transformer engine (Saxon/Xalan, etc).
From what I tested, when debugging with Xalan (XSLT 1.0), Step Into also stops in empty templates. However, Saxon doesn't seem to do the same.

BTW, a simpler workaround for this that does not affect the content is to use xsl:message.

Code: Select all

<xsl:template match="someElement">


Re: debugger missing empty templates

Posted: Thu Oct 05, 2017 9:08 pm
by xmlhelpline
thank you for your prompt reply. we are using saxon.
unfortunately we cannot use that workaround as we can't have tons of xsl:messages occur in production code that has no value. some templates remain empty for good reason. others get reworked as new data comes in.

if this is a saxon thing, please let me know and let's see if we can propose any adjustments.

Re: debugger missing empty templates

Posted: Fri Oct 06, 2017 4:19 pm
by adrian

From what our developers investigated, it seems to be a Saxon API issue (or limitation?) as Saxon does not notify the trace listener of the empty templates. This issue has been reported to Saxonica:
Somehow notify TraceListener that an empty xsl:template is being matched


Re: debugger missing empty templates

Posted: Mon Mar 19, 2018 3:06 pm
by teo

We released oXygen XML Editor version 20 and the problem reported here was fixed, by integration of the latest Saxon version.
So, the empty templates are no longer skipped when using "Step into" or breakpoints for debugging.

You can download the build from here: ... ditor.html