【发布时间】:2011-10-31 08:40:34
【问题描述】:
我已经使用以下代码使用 xsl 样式表将 xml 转换为 html。现在我必须将生成的 html 作为电子邮件发送给选定的人。我不知道该怎么做。请帮助!!!
//import name spaces
using System.Xml.Xsl;
using System.Xml.XPath;
using System.IO;
using System.Xml;
public static void Transform(string XmlPath, string XslPath){
try{
//load the Xml doc
XPathDocument XPathDoc = new XPathDocument(C:\Dibya\svnlog.xml) ;
XslTransform XslTrans = new XslTransform() ;
//load the Xsl
XslTrans.Load(C:\Dibya\svnlog.xsl) ;
//create the output stream
XmlTextWriter Writer = new XmlTextWriter
("CommitReport.html", null);
//do the actual transform of Xml
XslTrans.Transform(XPathDoc,null, Writer);
Writer.Close() ;
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
【问题讨论】:
-
此代码与您的要求没有任何关系。我认为你应该摆脱它。并查看SMTP Class