Web >> Development >> ASP.Net >> Web Controls >>  How to use XML control

<body> <form runat="server"> <asp:Xml DocumentSource="cdcatalog.xml" TransformSource="cdcatalog.xsl" runat="server" /> </form> <p><a href="cdcatalog.xml" target="_blank">View XML file</a></p> <p><a href="cdcatalog.xsl" target="_blank">View XSL file</a></p> </body> </html> where cdcatalog.xml contains:- <?xml version="1.0" encoding="ISO-8859-1" ?> - <catalog> - <cd> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> - <cd> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> - <cd> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd> - <cd> <artist>Gary Moore</artist> <country>UK</country> <company>Virgin records</company> <price>10.20</price> <year>1990</year> </cd> - <cd> <artist>Eros Ramazzotti</artist> <country>EU</country> <company>BMG</company> <price>9.90</price> <year>1997</year> </cd> </catalog> and cdcatalog.xsl contains:- <?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 xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> - <body> <h2>My CD Collection</h2> - <table border="1"> - <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> </tr> - <xsl:for-each select="catalog/cd"> - <tr> - <td> <xsl:value-of select="title" /> </td> - <td> <xsl:value-of select="artist" /> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>