RE: [xsl] Debugging XSL using Saxon

Subject: RE: [xsl] Debugging XSL using Saxon
From: "Hood, Earl" <earl.hood@xxxxxx>
Date: Fri, 16 Jun 2006 13:29:07 -0500
> Alternatively you can simply use xsl:message or the trace() function.
> (Sometimes rather than xsl:message I use xsl:comment, which
> inserts the
> diagnostic output into the result document).

The drawback with xsl:message is what to do with them after debugging.

What I've started to do is use a global debug parameter that can be
checked so your debugging xsl:messages can be turned on or off when
needed.  For example:

  <xsl:if test="$debug > 0">
    <xsl:message>...</xsl:message>
  </xsl:if>

The parameter is an integer.  You can conditionalize your statements
to only print out if $debug is set to a larger number, allowing
different levels of debugging output.

Have the default value for $debug be 0 and then you can override
it on the command-line when debugging is needed.

I'm not sure if this is good style, but it works for me.  If there
are better options, please pass them along.

--ewh
--
Earl Hood
Software Engineer
HP/ATCL
earl.hood@xxxxxx

Current Thread