XmlDataSource.Transform XmlDataSource.Transform XmlDataSource.Transform XmlDataSource.Transform Property


Gets or sets a block of Extensible Stylesheet Language (XSL) data that defines an XSLT transformation to be performed on the XML data managed by the XmlDataSource control.

 virtual property System::String ^ Transform { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter("System.ComponentModel.MultilineStringConverter,System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
[System.ComponentModel.TypeConverter("System.ComponentModel.MultilineStringConverter,System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public virtual string Transform { get; set; }
member this.Transform : string with get, set
Public Overridable Property Transform As String

Property Value

A string of inline XSL that defines an XML transformation to be performed on the data contained in the Data or DataFile properties. The default value is Empty.



The following code example demonstrates how to use an XmlDataSource control with a templated Repeater control to display transformed XML data. The style sheet that performs the transformation is defined inline by the Transform property of the data source control.

The XML file in the code example has the following data:

<?xml version="1.0" encoding="iso-8859-1"?>  
     <customer id="12345" />  
     <transaction id="12345" />  
         <address1>1234 Tenth Avenue</address1>  
         <item dept="tools">screwdriver</item>  
         <item dept="tools">hammer</item>  
         <item dept="plumbing">fixture</item>  


In declarative scenarios, the Transform property is specified as a multiline inner property of the XmlDataSource object. An inner property is compatible with XSL style sheet data, because it enables you to format the style sheet in any way and ignore character padding issues such as padding quote characters.

If both the TransformFile and Transform properties are set, the TransformFile property takes precedence and the data in the XSL style sheet file (.xsl) is used instead of the style sheet elements specified in the Transform property. If an XPath expression is set using the XPath property, it is applied after the XML data is transformed.

If you change the value of the Transform property, the DataSourceChanged event is raised. If caching is enabled and you change the value of Transform, the cache is invalidated.


The XmlDataSource class uses the deprecated XslTransform class to perform XSL transformations. If you want to use style sheet features that were introduced after the XslTransform class was deprecated, apply the transforms manually by using the XslCompiledTransform class.

Applies to

See also