Chapter 17
Debugging XSLT Transformations
In This Chapter
Testing for specific conditions at run-time
Adding a conditional debug mode
Tracing your XML transformation
I have a confession to make: Yes, it may be hard to believe, but I have had bugs appear in my XSLT stylesheets before. Perhaps you have never had that happen before, and if so, then feel free to skip this chapter. But, if you’re a mere mortal like me, read on. Knowing how to debug in XSLT is an important part of the stylesheet authoring process.
Debugging is one of those necessary evils of programming. It’s not much fun, but it sure is necessary. Unfortunately, XSLT is not a language that lends itself to easy debugging. Besides the xsl:message element, there is little in the language that provides debugging support. Most of the time, debugging becomes a trial and error process consisting of modifying the stylesheet and then running the transformation. If the results aren’t what you expect, then modify the XSLT and try again and again until everything works.
However, as you find out in this chapter, some XSLT debugging techniques are valuable tools that can help you track down problems.
Get XSLT for Dummies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.