navinarrows
New Member
Can someone please tell me what's wrong with this code? I get the error message:<BR><BR>"Object reference not set to an instance of an object."<BR><BR>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.<BR><BR><%@ Import Namespace="System.Xml" %><BR><%@ Import Namespace="System.Xml.Xsl" %><BR><BR><Script Language="VB" Runat="server"><BR>Sub Page_Load(Sender As Object, E As EventArgs)<BR><BR> Dim xmlDoc As XmlDocument = New XmlDocument()<BR> xmlDoc.Load(Server.MapPath("Customers.xml"))<BR> <BR> 'Create the XslTransform object<BR> Dim xslTrans As XslTransform = New XslTransform()<BR> <BR> 'Load the stylesheet<BR> xslTrans.Load(Server.MapPath("Treeview_Transform.xsl"))<BR> <BR> 'Transform the file - Error occurs here<BR> xslTrans.Transform("Customers.xml", "Customers2.xml")<BR> <BR> xmlTrans.save("C:Inetpubwwwrootdotnetcontrols reeviewCustomers2.xml")<BR>End Sub<BR></script><BR><BR>I think you need to do the transformation on the XML document not the xsl document.<BR><BR>xmlDoc.Transform(xsl doc)