Hi - I just converted an ASP.Net web app from 2.0 to 4.0 and the XslTransform code that I inherited no longer works in 4.0. I'm told I need to change the code to use XslCompiledTransform. Fine - but I can't figure out how to get XslCompiledTransform to do exactly what I need it to do. I have an XSL file in my project. I do not have an XML or HTML file. The old code read as follows:
using (DataSet data = DataGateway.getAbsence(TripNum)) 
  data.DataSetName = "Absence"; 
  data.Tables[0].TableName = "Employee"; 
  XmlDataDocument xmldoc = new XmlDataDocument(Data); 
  XslTransform xslt = new XslTransform; 
  string xsltfile = "myfile.xsl"; 
  TextWriter writer = new StringWriter(); 
  xslt.Transform(xmldoc, null, writer, null); 
  MailMessage mail = new MailMessage(); 
  mail.Body = writer.ToString(); 
  mail.From = "me"; 
  mail.To = "you"; 
  //more code to send mail...... 
I've tried to rewrite this by substituting and XsltCompiledTransform object for the XslTransform object, and an XmlWriter object for the TextWriter object, but the xslt.Transform line complains about my using an XmlDataDocument as input. It suggests an XmlReader instead, but I don't know how to pass the data from my DataSet into an XmlReader. Or perhaps XslCompiledTransform is not the way to go Does anyone know?