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

Subject: Re: [xsl] Managing debug logging in complex transforms: what do people do?
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Mon, 24 Mar 2014 20:02:08 -0000 (GMT)
On Mon, March 24, 2014 5:31 pm, Eliot Kimber wrote:
> 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").
> My question: is there a better way to do this? Am I overlooking some
> feature of XSLT 2 (or 3) that would make managing debugging messages
> easier? Should I step up to a more complete messaging framework that
> mirrors e.g., log4j?

I sometimes use multiple parameters that each could have the value 'yes'
or 'no' plus another parameter whose value is expected to be a
'+'-separated list of (some of) the other parameter's names, and the
default value for each of the other parameters is 'yes' if the parameter's
name is in the tokens in the other parameter's value, e.g.:

<xsl:param name="debug.1"
           select="if ($debug-list = 'debug.1')
                     then 'yes'
                   else 'no'"
           as="xs:string" />

Michael Kay has already mentioned static parameters [1] from XSLT 3.0,
though you've said they don't fit the way you work.  Another thing XSLT
3.0 gives you would be the ability to use a map for your debug parameter,
so you could do things based on whether or not a key is present in the map
or based on a key's value, and you could produce different maps in
different templates to pass to the templates that particular template


Tony Graham                                         tgraham@xxxxxxxxxx
Chair, Print and Page Layout Community Group @ W3C    XML Guild member
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
Mentea       XML, XSL-FO and XSLT consulting, training and programming


Current Thread