Cleaning up deprecated class System.Xml.Xsl.XslTransform(hockblogs.net)
submitted by
hockman(505) 3 years, 8 months ago
Hi there,
I'm currently in between two releases and I decided that is was time for some good-old-clean-up-of-the-code.
I've recently looked at the warnings that Visual Studio 2005 generates. And I've found out that I got the following warning:
'System.Xml.Xsl.XslTransform' is obsolete: 'This class has been deprecated. Please use System.Xml.Xsl.XslCompiledTransform instead.
On MSDN there's great article on how to migrate this deprecated class from 1.1 to .NET 2.0:
http://msdn.microsoft.com/en-us/library/66f54faw(VS.80).aspx
This ultimately resulted in my following solution, where url is an url to an XML document and writer is an HtmlTextWriter that will do the rendering:
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(Server.MapPath("/xsl/google_results.xslt"));
xslt.Transform(new XPathDocument(url), null, writer);
|category: Visual Studio
|Views: 86
tags:
VisualStudio another
Everyones tags:
Your Tags: