[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Debugging

Subject: Re: [xsl] Debugging
From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Aug 2014 09:24:42 -0000

Quoting myself: "Debugging Strategies is one of the most undertaught subjects in computer science."

On 15.08.2014 10:56, Michael Kay mike@xxxxxxxxxxxx wrote:

This raises the question, how should one approach the debugging of such problems, other than by staring at the code until you see the light.

It's common enough and we've all experienced it: you write a complex
expression that looks right, and it returns nothing, and you have no
clue why.

I'd suggest the following strategy:

1. Add something like

<debug><xsl:copy-of select="X"/></debug>

where X is the offending expression

2. If <debug/> comes out empty, successively remove predicates and axis
steps from X starting at the right-hand end, until you get some output.

3. When you get some output, the last step you removed was the one that
was wrong.

Michael Kay Saxonica mike@xxxxxxxxxxxx <mailto:mike@xxxxxxxxxxxx> +44 (0) 118 946 5893

On 14 Aug 2014, at 23:28, Ihe Onwuka ihe.onwuka@xxxxxxxxx <mailto:ihe.onwuka@xxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote:

Lord.... even after staring at the shorter version  multiple times I
did not see it. It's obviously been a long long day and I should have
walked away from this ages ago.

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe <-list/225679> (by email <>)

-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard VC6ckler

Current Thread