Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xmlHTTP & xsl...

Status
Not open for further replies.

rjonesX

Technical User
Jun 18, 2001
56
US
Its pretty simple what I need done. I need to pick up an xml file from...


using xmlHTTP in an ASP script located on a different server,

and have it transformed against a file called data.xsl

I tried this...

<%


Response.Buffer = True
Dim objXMLHTTP, xml

' Create an xmlhttp object:
Set xml = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
' Or, for version 3.0 of XMLHTTP, use:
' Set xml = Server.CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)

' Opens the connection to the remote server.
xml.Open &quot;GET&quot;, &quot; False

' Actually Sends the request and returns the data:
xml.Send


set xsl = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
xsl.async = false
xsl.load(Server.MapPath(&quot;../events/events.xsl&quot;))

Response.Write(xml.transformNode(xsl))
%>

BUt it says that transformNode is not acceptable... any ideas?
 
Fun stuff,
The first problem is that you are using a method from an XMLDOM object on an XMLHTTP object, this could be likened to using a Recordset.Open method on a AdBanner object, apples and oranges.

Try this one out:
Code:
  <%
  Response.Buffer = True
  Dim objXMLHTTP, xml

  ' Create an xmlhttp object:
  Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)
  Set xml = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)


  ' Opens the connection to the remote server.
  objXMLHTTP.Open &quot;GET&quot;, &quot;[URL unfurl="true"]http://www.rjonesx.com/ia/events/data.xml&quot;,[/URL] False
    
  ' Actually Sends the request and returns the data:
  objXMLHTTP.Send

  xml.loadXML(objXMLHTTP.responseText)
  set xsl = Server.CreateObject(&quot;Microsoft.XMLDOM&quot;)
  xsl.async = false
  xsl.load(Server.MapPath(&quot;../events/events.xsl&quot;))

  Response.Write xml.xml
  %>

Basically the responseText will spit out the response as ..um, text, yea, then your xml.LoadXML loads text into a dom model. If you look at the source after this runs you will see the xml, alter it back to use transformNode and you should be good to go.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top