Transforming an XML file

Results 1 to 2 of 2

Thread: Transforming an XML file

  1. #1
    Join Date
    Dec 1969

    Default Transforming an XML file

    Can someone please tell me what&#039;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>&#060;%@ Import Namespace="System.Xml" %&#062;<BR>&#060;%@ Import Namespace="System.Xml.Xsl" %&#062;<BR><BR>&#060;Script Language="VB" Runat="server"&#062;<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> &#039;Create the XslTransform object<BR> Dim xslTrans As XslTransform = New XslTransform()<BR> <BR> &#039;Load the stylesheet<BR> xslTrans.Load(Server.MapPath("Treeview_Transform.x sl"))<BR> <BR> &#039;Transform the file - Error occurs here<BR> xslTrans.Transform("Customers.xml", "Customers2.xml")<BR> <BR>"C:Inetpubwwwrootdotnetcontrols reeviewCustomers2.xml")<BR>End Sub<BR>&#060;/script&#062;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Transforming an XML file

    I think you need to do the transformation on the XML document not the xsl document.<BR><BR>xmlDoc.Transform(xsl doc)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts