XSLT debugging

XSLT debugging is not always straightforward with either the XSLT 1.0 stylesheets or the xslTNG stylesheets. The XSLT 1.0 stylesheets can preprocess a document to either strip or add namespaces, depending on the document and the stylesheet being run, which makes it meaningless to try to get an XSLT debugger to break when a source node is processed because every node is preprocessed. The xslTNG stylesheets make multiple passes over the document to, for example, convert a DocBook 4 document into DocBook 5 and normalise titles to be contained in <info> elements. The xslTNG stylesheets make extensive use of xsl:evaluate, so it is not always possible to set a break point on the source node to be processed by a particular template.

With both the XSLT 1.0 stylesheets and the xslTNG stylesheets, the first advice is to add xsl:message messages or to generate comments or literal text that will show up in the result to indicate that a particular template was used. The xslTNG stylesheets support an org.docbook.xsltng.verbose Java system property to control debugging messages output by the extension functions.