xsl-list
[Top] [All Lists]

Re: [xsl] Managing debug logging in complex transforms: what do people do?

2014-03-24 13:42:42

On 24 Mar 2014, at 17:31, Eliot Kimber <ekimber(_at_)contrext(_dot_)com> wrote:

For whatever reason I find using interactive debugging unhelpful for
debugging XSLT processing (but I couldn't code a line of Java without it).

That's my experience too, I have never been sure why the difference.

Thus I depend very heavily on debug messages in my XSLTs. I used to just
emit messages and then comment them out or delete them when I was done,
but then I found myself recreating those messages when I had to return to
that bit of code.

Then I started using a runtime parameter to turn debugging on or off
globally and using IF checks to output my messages. But that results in a
lot of messages when you've got a lot of debug messages, most of which are
not relevant to your current problem, so back to commenting things out or
disabling the IF check (e.g., test="false() and $doDebug").


There are two things in XSLT 3.0 designed to make this easier: xsl:assert, and 
static variables/parameters

xsl:assert is like xsl:message wrapped in an xsl;If.

Static variables can be used in conjunction with xsl:use-when effectively as an 
"ifdef", that is a compile-time conditional. So rather than commenting code 
out, you tag it with use-when="$DEBUG".

Michael Kay
Saxonica
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--