xsl-list
[Top] [All Lists]

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

2014-03-24 15:02:26
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
uses.

Regards,


Tony Graham                                         
tgraham(_at_)mentea(_dot_)net
Consultant                                       http://www.mentea.net
Chair, Print and Page Layout Community Group @ W3C    XML Guild member
  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
Mentea       XML, XSL-FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xslt-30/#static-params


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] Managing debug logging in complex transforms: what do people do?, Tony Graham <=