Shows how to restructure XML with Transformation files in ASP.NET

XML files can be structured differently. Some express properties of elements as attributes, whereas others express them as elements with inner text.
When working with the forementioned type of XML file (properties expressed as attributes), we are unable to access and display these attributes with such controls as the GridView. However, Visual Studio will enable us to transform the file so we can use it better.

This tutorial will show how we can create a Transformation file and use it to transform the XML file, so we can use all elements as originally intended.

An example XML file with properties expressed as attributes:

We can use this as an XmlDataSource as normal, but in Visual Studio where it asks for Transformation file, we can creat a text file with the .xsl extension and point to it from the Configure Data Source window..

The XSL file will look something like this:

Download Source Files