Debugging XSLT transformations with extension functions with the option of having breakpoints in both XSLT code and extension function code is supported with VS2005 .
Just use this XslCompiledTransform constructor overload .
Parameters enableDebug Type: System.Boolean true to generate debugging information; otherwise false. Setting this value to true allows you to debug the stylesheet using the Microsoft Visual Studio Debugger.
Notes
To enter the code and debug the style sheet, the following conditions must be met:
The enableDebug parameter is true.
The stylesheet is passed to Load either as a URI or an implementation of the XmlReader class that implements the IXmlLineInfo interface. The IXmlLineInfo interface IXmlLineInfo implemented in all text parsing of XmlReader objects.
In other words, if a stylesheet is loaded using an IXPathNavigable object, for example, an XmlDocument or XPathDocument , or an XmlReader implementation that does not implement the IXmlLineInfo interface, you cannot debug the stylesheet.
XmlResolver used to load the stylesheet - this is the file- XmlResolver , for example, XmlUrlResolver (this is the default XmlResolver used by XslCompiledTransform ).
The style sheet is located on the local computer or intranet.
Here is an example of a little code :
// Enable XSLT debugging. XslCompiledTransform xslt = new XslCompiledTransform(true); // Load the style sheet. xslt.Load("output.xsl"); // Create the writer. XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent=true; XmlWriter writer = XmlWriter.Create("output.xml", settings); // Execute the transformation. xslt.Transform("books.xml", writer); writer.Close();
Dimitre novatchev
source share