System.Xml.Xsl.XslTransformException was unhandled - Message="Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at "
private void TransformXML()
{
XslCompiledTransform trans = new XslCompiledTransform();
XsltSettings xslt_set = new XsltSettings();
xslt_set.EnableScript = true;
trans.Load(@"C:\ShasurData\Sample.xslt",xslt_set, new XmlUrlResolver() );
//XsltSettings.TrustedXslt
trans.Transform(@"C:\ShasurData\ForBlogger\Sample.xml", @"C:\ShasurData\ForBlogger\TransformedSample.html");
}
Solution
xslt_set.EnableScript = true;
and pass the xsltsettings to the load method
trans.Load(@"C:\ShasurData\Sample.xslt",xslt_set, new XmlUrlResolver() );
Enable Scripting Error in XSLT
No comments:
Post a Comment