Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Displaying and Parsing XML Document to HTML

I'm using a Online Product availability Check using XML.
For this i should reference a url which returns a XML document.
By parsing the XML document, I should show in the browser the results as
a html / asp file. How can i do this ?

Pl send me the method / code and it would be of great help to me.

Thanks
[340 byte] By [K Deviprasad] at [2007-11-9 14:55:11]
# 1 Re: Displaying and Parsing XML Document to HTML
"K Deviprasad" <kdp.cgmaersk@maerskdata.dk> wrote:
>
>I'm using a Online Product availability Check using XML.
>For this i should reference a url which returns a XML document.
>By parsing the XML document, I should show in the browser the results as
>a html / asp file. How can i do this ?
>
>Pl send me the method / code and it would be of great help to me.
>
>Thanks

You have to use XSL for generating the html. Below is the code of ASP file
that will parse the XML and apply the XSL to generate the html

************************ Code of ASP File ***************************************
<%@ LANGUAGE = JScript %>
<%
// Set the source and style sheet locations here
var sourceFile = Server.MapPath("test.xml");
var styleFile = Server.MapPath("test.xsl");
// Load the XML
var source = Server.CreateObject("Microsoft.XMLDOM");
source.async = false;
source.load(sourceFile);

// Load the XSL
var style = Server.CreateObject("Microsoft.XMLDOM");
style.async = false;
style.load(styleFile);
var result=source.transformNode(style);
Response.Write(result);

%>
********************************End Of ASP File************************************
Manish Gupta at 2007-11-11 23:33:50 >