How to pass pass XmlResolver to Transform() method?

T

Tony Fabian

Hi,

the code below produces the following warning:

'System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable,
System.Xml.Xsl.XsltArgumentList)' is obsolete: 'You should pass XmlResolver
to Transform() method'

Anyone know how to do that?


XmlDocument _xmlDocument;
XmlDocument _xmlOutput;
XmlReader _xmlReader;
XslTransform _xslTransform;

_xmlDocument = new XmlDocument();
_xmlOutput = new XmlDocument();
_xslTransform = new XslTransform();


_xmlDocument.Load(Server.MapPath("myxml.xml"));
_xslTransform.Load(Server.MapPath("myxsl.xslt"));


_xmlReader = _xslTransform.Transform(_xmlDocument, new XsltArgumentList());
_xmlOutput.Load(_xmlReader);

rssOutput.Text = _xmlOutput.OuterXml;



Kind regards

Tony
 
G

Guest

You could use this:

using (StringWriter sw = new StringWriter())
{
_xslTransform.Transform(_xmlDocument, null, sw, null);
_xmlOutput.LoadXml(sw.ToString());
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top