ASP 101 - Active Server Pages 101 xmlxsl.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<script language="VB" runat="server">
	Sub Page_Load(sender As Object, e As EventArgs)
		' Path to our XML and XSL files.
		Dim strXmlFile As String = Server.MapPath("xmlxsl.xml")
		Dim strXslFile As String = Server.MapPath("xmlxsl.xsl")
		' Load our XML file into the XmlDocument object.
		Dim myXmlDoc As XmlDocument = New XmlDocument()
		' Load our XSL file into the XslTransform object.
		Dim myXslDoc As XslTransform = New XslTransform()
		' Create a StringBuilder and then point a StringWriter at it.
		' We'll use this to hold the HTML output by the Transform method.
		Dim myStringBuilder As StringBuilder = New StringBuilder()
		Dim myStringWriter  As StringWriter  = New StringWriter(myStringBuilder)
		' Transform the XML file using the XSL stylesheet
		' We do this by calling the Transform method of the XslTransform
		' object and passing it our input via the XmlDocument and getting
		' our output back via the StringWriter.
		myXslDoc.Transform(myXmlDoc, Nothing, myStringWriter)
		' Take our resulting HTML and display it on the web page.
		' The data comes from the .xml file, but the formatting of the
		' results depends completely upon the .xsl file.
		litOutput.Text = myStringBuilder.ToString
	End Sub
<title>ASP.NET XML to HTML (via XSL) Sample</title>
<form runat="server" EnableViewState="false">
<asp:Literal id="litOutput" runat="server" />
Here are the source <a href="xmlxsl.xml">XML</a> and <a href="xmlxsl.xsl">XSL</a> files.
<hr />
Click <a href="">here</a>
to read about and download the source code.