XSL can be used to transform XML into HTML. XSL allows format definitions, data filtering, manipulation, sorting and use of output template definitions. Templates can be used to display the XML document or parts thereof is specific ways. Multiple templates can even be used to display separate parts and subsets of an XML document in different ways.
<?xml version="1.0"?> <HTML> <BODY> Weather Report <xsl:value-of select="@date"/> An attribute retrieval requires an @ sign. <xsl:for-each select="city order-by="+ name"> The city objects iteration. <xsl:value-of select="name"/> Snow : <xsl:value-of select="min"/><xsl:value-of select="max"/> </xsl:for-each> </xsl:for-each> </BODY> </HTML>
<% @LANGUAGE = VBScript %>
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>XML Using XSL</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<%
Dim XMLDoc, XSLDoc
Set XMLDoc = Server.CreateObject ("Microsoft.XMLDOM")
Set XSLDoc = Server.CreateObject ("Microsoft.XMLDOM")
XMLDoc.async = False
XMLDoc.load (Server.MapPath("weatherForecast.xml"))
XSLDoc.async = False
XSLDoc.load (Server.MapPath("weatherForecast.xsl"))
Response.Write (XMLDoc.documentElement.transformNode (XSLDoc.documentElement)) This applies the syle sheet to the data.
%>
</BODY>
</HTML>