[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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!
0
bearpaws
Asked:
bearpaws
  • 4
  • 2
1 Solution
 
sivic82Commented:
Goto the designer view and drop in the xml control. This control allows you to transform the xml with xsl. Once you drop the control in click on it and set the transformsource property to point to your xsl document.

Then switch to your codebehind and reference the xml control you dropped in..

XmlControl1.document = MyXmlDocument
0
 
bearpawsAuthor Commented:
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>
0
 
bearpawsAuthor Commented:
forogot to add the error message

Error BC30188: Declaration expected.

this is confusing....sigh
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
bearpawsAuthor Commented:
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>
0
 
bearpawsAuthor Commented:
I am awarding you points for taking the time to response and so forth - :-)
0
 
sivic82Commented:
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.

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now