附加xml文件,并在邮件中应用xsl [英] Attach an xml file with xsl applied to it in mail
本文介绍了附加xml文件,并在邮件中应用xsl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想在我的邮件中附加一个xsl应用的xml文件。
在我的项目中,当我选择一个xml文件并发送它是某人(地址),然后它应该附加xml文件与xsl应用于它并发送到toAddress。
我已经编写代码,但它添加在正文中。我想用邮件附加动态创建的文件
我的代码:
Hi all,
I want to attach an xml file with xsl applied to it in my mail.
In my project, when i select an xml file and send it to someone(to address), then it should attch that xml file with xsl applied to it and sent to toAddress.
I have written code, but its added in body. I want it to attach with dynamic created file in mail
My code:
string strFullPathXml = Server.MapPath("strCCDXml.xml");
string strFullPathXsl = Server.MapPath("xsl.xsl");
string strFullPathHtml = Server.MapPath("Result.html");
StringBuilder sb = new StringBuilder();
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(strFullPathXsl);
using (XmlTextWriter xtw = new XmlTextWriter(new StringWriter(sb)))
{
xslt.Transform(strFullPathXml, xtw);
xtw.Flush();
}
推荐答案
这不是权威的答案,但您可以尝试。如果在xml文件头中嵌入对xsl转换的引用,则某些Microsoft产品(例如IE)将看到转换后的xml而不是源。
您的问题很模糊 - 我不确定这是否符合您的需求或做您想做的事。
This is not an authoritative answer but something you can try. If you embed a reference to the xsl transform in the xml file header, some Microsoft products (eg. IE) will see the transformed xml instead of the source.
Your question is vague - I'm not sure if that meets your needs or does what you want.
这篇关于附加xml文件,并在邮件中应用xsl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文