TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Melanie Peterson
NA
7
0
Convert XslTransform to XslCompiledTransform
Nov 14 2011 11:44 AM
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:
[CODE]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";
xslt.Load(xsltfile);
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......
}[/CODE]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?
Thanks!
Reply
Answers (
4
)
Adding another New Row for the same ID
Recovery of table data SQL Server