The data at the root level is invalid. Line 1, position 1.

Runtime_error

Active member
Joined
Aug 5, 2003
Messages
38
Hi, i am trying to populate a treeview control in asp.net in C# using an xml file :(. but i cant seem to get the XSLT file right.


Code for the treeview on the webform
---------------------------------------------------------------------
<ie:TreeView runat="server" ID="Treeview1" Width="136px" Height="272px">

<ie:TreeNode Text="SkillSet" TreeNodeSrc="Skills.xml"
TreeNodeXsltSrc="Skills.xslt" Expanded="True" ID="Treenode1">

</ie:TreeNode>
</ie:TreeView>


The xml file
---------------------------------------------------------------------

<?xml version="1.0" encoding="ISO8859-1" ?>
<Industry Title="IT Industry">
<Category Title="Programming">
<Skill>C Sharp</Skill>
<Skill>VB.net</Skill>
</Category>
</Industry>


Code for the xSLT file
---------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<TREENODES>
<xsl:for-each select="Industry ">
<treenode>
<xsl:attribute name="text">
<xsl:value-of select="@Title" />
</xsl:attribute>

<xsl:for-each select="Category">
<treenode>
<xsl:attribute name="text">
<xsl:value-of select="@Title" />
</xsl:attribute>

<xsl:for-each select="Category/Skill">
<treenode>
<xsl:attribute name="text">
<xsl:value-of select="text()" />
</xsl:attribute>
</treenode>
</xsl:for-each>
</treenode>
</xsl:for-each>
</treenode>
</xsl:for-each>
</TREENODES>
</xsl:template>


</stylesheet>


Each Industry has categories, and each Category has Skills

Forexample

Industry = IT
Category = Programming
Skill = C#
Skill = C++

Please help as i been trying to get it right for sometime now without any success :(. Thanks
 
Back
Top