Rendering Using XSL (eXtensible Style Sheets)

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.

The Style Sheet

<?xml version="1.0"?>


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"/>


The Server Side Script

<% @LANGUAGE = VBScript %>
<% Option Explicit %>




	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.