[英]How to convert from XslTransform of VS2003 to XslCompiledTransform of VS2005?
We are currently converting our project from VS2003
to VS2005
and I'm looking for the right way to convert the code using XslTransform
to XslCompiledTransform
. 目前,我们正在将我们的项目从
VS2003
转换为VS2005
,我正在寻找正确的方法,以使用XslTransform
将代码XslTransform
为XslCompiledTransform
。
The changing the class name is not the big deal, but when it comes to using XslCompiledTransform's
Transform method, I have a problem. 更改类名并不重要,但是在使用
XslCompiledTransform's
Transform方法时,我遇到了问题。
Before XslTransform's
Transform method was accepting XPathDocument
object and right now Transfrom
method expect XmlReader
instead: 在
XslTransform's
Transform方法接受XPathDocument
对象之前,现在Transfrom
方法期望使用XmlReader
代替:
Here is the code: 这是代码:
XslCompiledTransform xslt = new XslCompiledTransform();
XPathDocument doc = new XPathDocument(new StringReader(DS.GetXml().ToString()));
StringWriter sw = new StringWriter();
xslt.Transform(doc,null,sw,null);
Also, new Transform
method expect System.Xml.XmlWriter
instead of System.IO.StringWriter
. 另外,新的
Transform
方法期望使用System.Xml.XmlWriter
而不是System.IO.StringWriter
。
What is the best way to fix that? 解决此问题的最佳方法是什么?
Thank you 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.