Transforming XML with XSLT on the Server - XML Views : 281
Tagged in : XML
0 0
Send mail
Transforming XML with XSLT on the Server
****************************************

This ASP transforms an XML file to XHTML on the server:
<%
'Load XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("simple.xml"))

'Load XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("simple.xsl"))

'Transform file
Response.Write(xml.transformNode(xsl))
%>

Example explained

* The first block of code creates an instance of the Microsoft XML parser (XMLDOM), and loads the XML file into memory.
* The second block of code creates another instance of the parser and loads the XSL file into memory.
* The last line of code transforms the XML document using the XSL document, and sends the result as XHTML to your browser. Nice!
By satheesh, On - 2010-02-04



    Login to add Comments .