Active Server - Transform XML Through XSLT In ASP.NET (ASP.NET 1.0+)
With classic ASP, as you know from previous tips, you can use the MSXML DOM to transform XML content with XSLT and display the results in your Web browser. So how do you do this in ASP.NET? The answer, like most answers to previously complicated questions, is very simple: use the XML server control.
To do so, all you do is drag an XML control onto the design surface of your Web page (or add it programmatically to the script source), then specify the location of the XML document as well as the XSLT stylesheet to use in transforming it. For instance:
- <asp:xml runat="server" id="MyXmlDoc"
- TransformSource="transformation.xsl" />
The results are streamed right into the browser; no code is needed!