There is a nice example on the Microsoft Website (Even vor .Net 4)
Dim xmlDoc As XmlDataDocument = New XmlDataDocument(dataSet)
Dim xslTran As XslTransform = New XslTransform
xslTran.Load("transform.xsl")
Dim writer As XmlTextWriter = New XmlTextWriter("xslt_output.html", System.Text.Encoding.UTF8)
xslTran.Transform(xmlDoc, Nothing, writer)
http://technet.microsoft.com/en-us/query/8fd7xytc
No unfortunately XmlDataDocument is deprecated, but nobody seems to have a good answer on how to replace it in this situation?
You can use the following code.
Use
DataSet.GetXml()to get the xml as string and then create an XDocument by parsing the string:The setup of the transformation and its output is the same, except using XslCompiledTransform:
And then you can use the
XslCompiledTransform.Transform()overload that takes a reader as the first argument, which you can get from callingXDocument.CreateReader():