Subject: Re: [xsl] Debugging (was: template matching on text value of a parent......not) From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 15 Aug 2014 13:30:44 -0000 |
On Fri, Aug 15, 2014 at 08:56:59AM -0000, Michael Kay mike@xxxxxxxxxxxx scripsit: > 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. An alternative, and I have trouble remembering to do this even when I've hit the staring-and-staring stage, is to not try to write the complex expression in one go. Write it in steps with tests for "something came back!" between the steps. Possibly write the XPath in steps in an XML database tool against known input, if you have both of those things. -- Graydon
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Debugging, Imsieke, Gerrit, le- | Thread | Re: [xsl] Debugging (was: template , BR Chrisman brchrism |
Re: [xsl] Debugging, Imsieke, Gerrit, le- | Date | [xsl] FOP : consumption memory, Jean-Pierre Lamon jp |
Month |