ASP 101 - Active Server Pages 101 xmlxsl_remote.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.
		' For illustration, I'm pulling the XML file via HTTP and the
		' stylesheet via the filesystem.  You can get either file from
		' whichever source makes sense for your application.  Oh and
		' once again... you'll need to replace our internal address
		' (10.2.41.60) with www.asp101.com if you want to try this
		' sample on your own server.
		Dim strXmlFile As String = "http://10.2.41.60/samples/xmlxsl.xml"
		Dim strXslFile As String = Server.MapPath("xmlxsl.xsl")
		' Load our XML file into the XmlDocument object.
		Dim myXmlDoc As XmlDocument = New XmlDocument()
		myXmlDoc.Load(strXmlFile)
		' Load our XSL file into the XslTransform object.
		Dim myXslDoc As XslTransform = New XslTransform()
		myXslDoc.Load(strXslFile)
		' 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
</script>
<html>
<head>
<title>ASP.NET XML to HTML (via XSL) - Remote - Sample</title>
</head>
<body>
<form runat="server" EnableViewState="false">
<asp:Literal id="litOutput" runat="server" />
</form>
<p>
Here are the source <a href="xmlxsl.xml">XML</a> and <a href="xmlxsl.xsl">XSL</a> files.
</p>
<hr />
<p>
Click <a href="http://www.asp101.com/samples/xmlxsl_remote_aspx.asp">here</a>
to read about and download the source code.
</p>
</body>
</html>