All of us use XSL and XML,but do you know how to debug XSL files via .net(2.0 or above)?
Really it’s very simple but I think it’s very useful also.using the following few lines of code you can debug XSL.
XmlTextReader xmlSource = new XmlTextReader(“XMLFile1.xml”);
XPathDocument xpathDoc = new XPathDocument(xmlSource);
XmlTextReader xslSource = new XmlTextReader(“XSLTFile1.xsl”);
//note if this parameter eqaul false you can’t debug
XslCompiledTransform xsltDoc = new XslCompiledTransform(true);
xsltDoc.Load(xslSource);
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
xsltDoc.Transform(xpathDoc, null, sw);
As you see it’s very simple just use XslCompiledTransform instead of XslTransform
Note you can also debug XSL via XMLSPY tool
February 11, 2009
Posted by mohammedatef83 |
Developement | Debug, XML, XMLSPY, XSL, XSLT |
Leave a Comment