The content for your application is in XML format, and you need to transform it to HTML for display in a browser.
Use an ASP.NET XML control and set
DocumentSource property to the XML document you
need to transform and the
to the XSLT document that specifies the transformation to be
.aspx file, place an
asp:Xml control where you want the HTML from the
transformation to be placed in the page.
In the code-behind class for the page, use the .NET language of your choice to:
DocumentSource property of the XML control
to the relative path to the XML document to convert.
TransformSource property to the relative
path to the XSLT document.
Example 18-5 through Example 18-7 show the
.aspx file and
VB and C# code-behind files for an application that demonstrates this
solution. The XML used as the source is shown in Example 18-8, and the XSLT used to transform the XML is
shown in Example 18-9. The output transformed to HTML
is shown in Figure 18-1.
Figure 18-1. Transforming XML to HTML output
XML is quickly becoming the predominant format for storing content. XML provides a platform-independent format that can easily be converted to many other formats, including HTML. By storing the content for your web application in XML, the same content can be transformed to the HTML needed for ...