How to Debug XSLT on the fly
one of my friend asked me how to Debug XSLT at runtime. Means if i have one XML and XSLT and my code does parsing of XML at run time using XSLT using XSLCompiledTransform Class with some parameters which are coming dynamic. Here’s the way to do it:
Basic requirement is that you MUST be using XSLCompiledTransform for Transformation. If you are not using it then use it. It’s really great class.
1. Locate your Transformation code.
2. locate your XslCompiledTransform class’s instantiation code e.g.
// Enable XSLT debugging. true is the guy who does the magic
XslCompiledTransform xslt = new XslCompiledTransform(true);
3. Now go to your Transform method and put breakpoint.
xslt.Transform(sourceFile, null, outputStream); //PUT Breakpoint on me!
4. Run your code in DEBUG mode and when BreakPoint comes at Transform method press F11 for stepping in to the code.
NOTE : Please disable debugging (XslCompiledTransform xslt = new XslCompiledTransform();) once your code is ready for deployment