|Chapter 17 - Debugging XSLT Transformations|
|XSLT For Dummies|
|by Richard Wagner|
|Hungry Minds 2002|
In This Chapter
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 youre 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. Its 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 arent 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.
Technical Stuff Got that deer in the headlights look? You may have if youve programmed in a traditional language and are trying to figure out how to debug XSLT. Debugging in a language like C, Java, or Visual Basic is relatively straightforward because you can intuitively see a program being executed line by line as you check the code. But exactly how XSLT is processed is far more opaque , often resembling the man behind the curtain. But, as you begin to think in XSLT, this new process becomes second nature.