I am editing an xlst file and I cannot run it. How do I do that? Under "XML" I can only see "Create Schemas"(unclickable) and "Schemas". There should be an option to start xslt with or without debugging.
It is plausible that you're running version of Visual Studio where XSLT debugging feature is not made available. See MSDN: Debugging XSLT :
"XSLT debugging is available in the Visual Studio Team System and the Professional Edition."
I'm currently using Visual Studio 2015 Community Edition in my personal laptop and it doesn't have XSLT debugging menu. At the same time, my work laptop has Visual Studio 2012 installed, Professional Edition if I remember correctly, and it indeed has the XSLT debugging menu available.
Like says in https://msdn.microsoft.com/fr-fr/library/ms255603.aspx, you must use the XslCompiledTransform
class and enable debug mode in the constructor parameters.
Now when you will debug your application, VS will break on your breakpoints in your xlst file.
var xsl = new XslCompiledTransform(enableDebug :true);
xsl.Load("transform.xslt");
var reader = XmlReader.Create("file.xml");
XmlDocument doc = new XmlDocument();
doc.Load("file.xml");
var outputPath = Path.GetTempFileName();
using (var stream = File.OpenWrite(outputPath))
{
xsl.Transform(reader, null, stream);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With