Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2005, 12:21 PM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML/XSL to actual HTML

I have an XML document which is transformed using XSL so it appears in a browser as XHTML. However, I now want to send this document as an HTML email from an ASP.NET application. I presume that in order to do this I need to physically transform the XML into its HTML equivalent. Can anyone tell me how to do this? If I just send the XML in an email my email client tries to interpret the XML elements as HTML tags completely ignoring the XSL reference...
 
Old December 9th, 2005, 12:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would assume that you can use the Xml control to transform the XML document into the HTML and the get a string representation, which you can the give to the emailer. Tjek out the properties DocumentSource and DocumentTransform.

Let me know how it works out.

Hope it helps, Jacob.
 
Old December 9th, 2005, 01:18 PM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jacob, thank you so much. Hadn't used the XML control before. I now have an ASPX page that displays my XML as HTML so that's great. One thing though - I'm not sure how to now get this HTML as a string. My XML control has the ID submissionXml so I'm using submissionXml.DocumentSource to set the XML source and submissionXml.TransformSource to set the XSL source. However, the ToString() method only seems to write out the control type as a string. I can't find any methods of the XML control that return a string version of the XML. Advice appreciated...
 
Old December 9th, 2005, 01:36 PM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've worked it out! Thanks for your help Jacob.

----------------

WebRequest htmlRequest = HttpWebRequest.Create("http://......");
WebResponse htmlResponse = htmlRequest.GetResponse();
StreamReader htmlStream = new StreamReader(htmlResponse.GetResponseStream());
string strSubmission = htmlStream.ReadToEnd();






Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML code from XML to display using XSL koenige XSLT 6 October 27th, 2008 08:11 AM
line number in xml using xsl and html link mrame XSLT 3 June 17th, 2008 01:36 PM
Rendering HTML inside XML through XSL - HELP !!! jilly XSLT 6 May 23rd, 2007 10:36 AM
xml to html with xsl boblavinsky XSLT 4 January 5th, 2007 05:30 AM
xml and xsl templates as input to xslt gives xml rameshnarayan XSLT 5 August 3rd, 2005 01:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.