Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
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();
                   }
Posted

1 solution

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.
 
Share this answer
 
Comments
akee seth 1-Aug-13 1:46am    
BryDon, simply my need is to attach xml file in mail and user can see human readable xml content on a single transmission. And i can not change xml or xsl file.
Hope it makes clear.
H.Brydon 1-Aug-13 19:55pm    
If you can't alter the xml information, then this technique will not work...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900