RE: [xsl] Debugging XSL using Saxon

Subject: RE: [xsl] Debugging XSL using Saxon
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 17 Jun 2006 14:28:45 +0100
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.hood@xxxxxx] 
> Sent: 16 June 2006 19:29
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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.hood@xxxxxx 

Current Thread