Link to home
Start Free TrialLog in
Avatar of bearpaws
bearpaws

asked on

XML Transform

I am using Asp.Net and wondered if the TransformNode is outdated to use??

This may sound pretty silly but can someone tell me why I receive this error message:
   BC30456: 'transformNode' is not a member of 'System.Xml.XmlDocument'.


from this line of coding:

response.write(xmlDoc.transformNode(xsl))

thanks!
ASKER CERTIFIED SOLUTION
Avatar of sivic82
sivic82

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bearpaws
bearpaws

ASKER

I have a version in which I did that, and I receive this error:
(I can not win with this wimple task :((()

<%@ Page Language="VB" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.Xml.XPath" %>
<%@ import Namespace="System.Xml" %>
<%@ import Namespace="System.Xml.Xsl" %>
<%@ import Namespace="System.Xml.XmlDocument" %>
<script runat="server">

    dim myXmlDocument as New XMLDocument()
   
    myXmlDocument = Xml1.Document

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:Xml id="Xml1" runat="server" TransformSource="myTest.xsl" DocumentSource="myTest.xml"></asp:Xml>
    </form>
</body>
</html>
forogot to add the error message

Error BC30188: Declaration expected.

this is confusing....sigh
I got it! Here's the solution! Yahoo!


<%@ Page Language="VB" %>
<%@ import Namespace="System.Xml" %>
<%@ import Namespace="System.Xml.Xsl" %>
<script runat="server">

    Sub Page_Load(sender As Object, e As EventArgs)
       Dim objDoc As XmlDocument = New XmlDocument()
       Dim objTrans As XslTransform = new XslTransform()

       objDoc.Load(Server.MapPath("test.xml"))


       objTrans.Load(Server.MapPath("test.xsl"))

       xml1.Document = objDoc
       xml1.Transform = objTrans
    End Sub

</script>
I am awarding you points for taking the time to response and so forth - :-)
In your other example you just tried to set the xml document to the control when it should have been the other way around..

  dim myXmlDocument as New XMLDocument()
  myXmlDocument = Xml1.Document

should be

  dim myXmlDocument as New XMLDocument()
  Xml1.Document = myXmlDocument

But im glad you got it fixed thats all that matters.