Andrew Welch wrote:
> On 19/03/2008, Michael Kay <mike@...> wrote:
>> Another way(*) you could do this is
>> allowing you to control which xsl:message instructions are active by setting
>> Java system properties.
> Nice, but couldn't you improve that a little by doing:
> use-when="system-property('message.level) >= $debug)
> or say...
That seems to be a different kind of selection rather than an
improvement as such. Mike's suggestion is a way of focussing the
debugging information on a particular area (function) within the
transform - you can get information on say access to additional
documents, access to a database, string manipulation. Most useful is
that you can select any combination of these, for example
xslt.debug='ABF' (but not C, D and E).
Your proposal is orthogonal to that I think, in that it suggests
defining a number of levels of detail, e.g. every step or only exception
paths. So xslt.debug='2' gets you failures and warnings but not normal
The two ideas can be combined by having xslt.debug='A=1,B=2,F=3' (which
traces three areas at different levels of detail). Then you need to
decouple the information from the processing by saying
use-when="f:tracing('A', $error)" where the implementation of
f:tracing() is left as an exercise for the reader ;-)
I have implemented a trace system of this kind of complexity in a
procedural environment where it proved very useful, especially in
combination with a circular buffering facility which lets you spit out a
brief history when you hit an error without filling up a permanent error
log. But I'm not sure how useful it is in a functional environment such
as XSLT where you don't want a blow by blow account of a process
(because it doesn't make sense to think like that) rather you want to
know given a fragment of output where did that come from?
So given the string 42 in the output I want to know that it came from
the expression "openBalance + sum(transaction/value)" on line 35 in a
template when the context node was
I don't see how you easily get that from the xsl:message style of debugging.
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771363
email: tcn@... web: http://www.melvaig.co.uk
Registered in Scotland No 194737
5 Melvaig, Gairloch, Ross-shire IV21 2EA