XSLT transformation in memory using C#

送分小仙女□ 提交于 2019-12-01 08:51:19
transformedDoc.Load(reader.ReadToEnd());

Load reads from a path; you probably want transformedDoc.LoadXml(...). But in all honesty, you could just write the whole thing to a StringWriter - more direct:

string output;
using(var writer = new StringWriter())
{
    processor.Transform(xdoc.CreateNavigator(), null, writer);
    output = writer.ToString();
}

Plus it will work for non-xml outputs (xslt is not obliged to output xml).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!