ASP.NET XML Control

Definition and Usage

The XML control is used to display XML documents or the results of XSL transformations.

Properties

By setting one of these three properties - Document, DocumentContent, or DocumentSource - you can specify the XML document to be displayed. These properties represent different types of XML documents that can be displayed. By setting the appropriate properties, you can display System.Xml.XmlDocument, an XML string, or an XML file.

By setting either the Transform or TransformSource property, you can specify an XSL transformation (XSLT) style sheet that formats the XML document before it is written to the output stream. These properties represent different types of XSL transformation style sheets that can be used to format XML documents. By setting the appropriate properties, you can format XML documents using the System.Xml.Xsl.XslCompiledTransform object or an XSL transformation style sheet file. If no XSL transformation style sheet is specified, the XML document is displayed using the default format.

The Xml class also provides the TransformArgumentList property, which allows you to provide an XSL transformation style sheet with optional parameters. These parameters can be XSL transformation (XSLT) parameters or extended objects.

Properties Description .NET
Document Not recommended for use. Specifies the XML document using the System.Xml.XmlDocument object. 1.0
DocumentContent Specifies an XML string. 1.0
DocumentSource Specifies the path of the XML document displayed in the XML control. 1.0
runat Specifies that this control is a server control. Must be set to "server". 1.0
Transform Use the System.Xml.Xsl.XslTransform object to format the XML document. 1.0
TransformArgumentList Contains an optional list of parameters passed to the stylesheet and used in the Extensible Stylesheet Language Transformation (XSLT).  
TransformSource Specifies the path to the XSL transformation file.  
XPathNavigator Cursor model used for navigation and editing XML data associated with the XML control.  

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls 
EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site 
TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a complete description, please visitControl Standard Properties.

Example

XML
This example demonstrates how to use XML controls to display the results of an XSL transformation.