try
{
//Create a new XslTransform object.
XslCompiledTransform xslt = new XslCompiledTransform();
//Load the stylesheet.
var xlst = "xlstPath";
xslt.Load(xlst);
//Create a new XPathDocument and load the XML data to be transformed.
var path = "xmlPath";
XPathDocument mydata = new XPathDocument(path);
//Create an XmlTextWriter which outputs to the console.
XmlWriter writer = new XmlTextWriter(Console.Out);
//Transform the data and send the output to the console.
xslt.Transform(mydata, null, writer, null);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.InnerException.Message);
}
调用xlst执行转换
最新推荐文章于 2025-05-07 13:56:22 发布