How to Debug XSLT on the fly

Challenge:

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:

Solution:

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.
Happy Debugging!
NOTE : Please disable debugging (XslCompiledTransform xslt = new XslCompiledTransform();) once your code is ready for deployment

Reference :

http://msdn.microsoft.com/en-us/library/ms255603(VS.80).aspx