---
title: "XML Control in ASP.Net"  
description: "The XML control is used to display an XML document. XSLT document is used to format the XML document. You can format the XML document with the Transfo"  
author: "Pushpendra Singh"  
published: 2010-10-22  
updated: 2020-04-04  
canonical: https://www.mindstick.com/articles/178/xml-control-in-asp-dot-net  
category: "xml"  
tags: ["xml"]  
reading_time: 1 minute  

---

# XML Control in ASP.Net

The XML [control](https://yourviews.mindstick.com/view/83439/bipartisan-gun-control-bill-passed-in-us-after-decades) is used to display an XML [document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool). XSLT document is used to [format](https://www.mindstick.com/forum/162083/how-to-convert-ost-files-into-pst-format) the XML document. You can format the XML document with the [Transform](https://www.mindstick.com/interview/511/what-are-the-steps-to-transform-xml-into-html-using-xsl) property.\

**[Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):**

```
<asp:Xml ID="Xml1" runat="server" DocumentSource="~/XMLFile.xml"  TransformSource="~/XSLTFile2.xslt" Visible="true"></asp:Xml>
```

In DocumentSource propertyspecify the xml [file name](https://answers.mindstick.com/qa/95119/what-should-i-do-in-windows-10-if-the-pdf-file-name-is-too-long-and-the-windows-options-don-t-give-me-the-possibility-to-rename-it) which data you want to show on the page. And in TransformSource specify the xslt file name which format tha xml document.

## XMLFile.xml

```
<?xml version="1.0" encoding="utf-8" ?><?xml-stylesheet type="text/xsl" href="XSLTFile.xslt"?><Country>  <cd>  <State>U.P.</State>  </cd>  <cd>  <State>M.P.</State>  </cd>  </Country>
```

XSLT is used to transform an XML document into another XML document. XSL stands for [EXtensible](https://www.mindstick.com/blog/59/xaml-extensible-application-markup-language) Stylesheet Language. XSLT is for XSL Transformations.

**XSLTFile2.xslt**

```
<?xml version="1.0" encoding="iso-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">  <xsl:template match="/">    <html>      <body>         <h2>State in India</h2>         <table border="1">          <tr bgcolor="#9acd32">            <th>State </th>          </tr>          <xsl:for-each select="Country/cd">            <tr>              <td>                <xsl:value-of select="State" />              </td>                   </tr>          </xsl:for-each>         </table>      </body>    </html>  </xsl:template></xsl:stylesheet>
```

Run the [project](https://yourviews.mindstick.com/story/1788/things-to-ensure-your-construction-project-is-successful)

![XML Control in ASP.Net](https://www.mindstick.com/mindstickarticle/d960aa32-dc17-422f-bea6-42bfb40d2095/images/0f9eafdf-de4d-4415-94c9-b6c7cbce9184.png)

---

Original Source: https://www.mindstick.com/articles/178/xml-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
