This is my XML file. It fetched from a sql datatable using sql datasource from a Nvarchar record as string.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Artist.xsl"?>
<artists>
<artist>
<name>KATY PERRY</name>
<id>1</id></artist>
<artist>
<name>SNOOP DOGG</name>
<id>2</id>
</artist>
</artists>
The XSL style sheet is in the same folder as aspx page and looks like this
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match ="/">
<html>
<body>
<h2>Artist</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="/artists/artist">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="id"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
My aspx control is a literal inside a listview with the following markup
<ItemTemplate>
<td runat="server" style="">
<asp:Literal ID="CoverartLabel" runat="server" Text='<%# Eval("Coverart") %>'></asp:Literal>
<a href="View.aspx/Album/<%# Eval("Id") %>"><%# Eval("Name") %></a>
<br />
<div>
<asp:Literal ID="ArtistsLabel" runat="server" Text='<%# Eval("Artists")%>' Mode="Encode"></asp:Literal>
<br />
</div>
<asp:Literal ID="SongsLabel" runat="server" Text='<%# Eval("Songs") %>'></asp:Literal>
<asp:Label ID="LikesLabel" runat="server" Text='<%# Eval("Likes") %>' />
<br />Comments:
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
<br /></td>
</ItemTemplate>
When I run the page I get the output as
Can some one help me figure out why the xml is not displayed as html. I ve tried changing the literal Artistlabel mode with no luck. Even played with the XSL file and its location?