In XSLT 2.0 you can do
<xsl:message use-when="system-property('debug')='yes')">...
where debug is a Java system property. This gives you a compile-time test
rather than run-time. The only drawback is that access to system properties
might vary between processors.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Hood, Earl [mailto:earl(_dot_)hood(_at_)hp(_dot_)com]
Sent: 16 June 2006 19:29
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Debugging XSL using Saxon
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(_dot_)hood(_at_)hp(_dot_)com
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--