Michelle,
Try using the System.Web.UI.WebControls.Xml control. Drop the control onto
your web form or user control and set the "DocumentSource" to the url of your
xml data. Then set the "TransformSource" property to the url of an XSLT file.
When you run your page the Xml control will perform a transformation and
display your xml data. I've written a simple XSLT sample here that you can
test with:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/companies/company">
<table border="1">
<tr>
<td>
<xsl:value-of select="@Name" />
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
The XSLT transform above will produce an HTML table that displays the
company name on separate rows as shown below:
ABC Company
XYZ Company
HTH,
Jorge
"Michelle" wrote:
Hi, I want to display some pretty basic xml data in
a .NET user control that I would like to build for my
site.
I am getting the XML from a URL that has been provided to
me (i.e. http://domain.com/somelink.asp). If I type the
URL into my browser, the xml doc below is displayed. How
can I incorporate the XML into the user control so that I
can display the company name on my web page?
The XML doc looks like this:
<companies>
<company ID="1" Name="ABC Company"/>
<company ID="2" Name="XYZ Company"/>
<companies>
Thanks for your help.