ASP - SelectNodes - Error on Transform

I am attempting to do a transform through ASP on some XML, then use an Xsl file to output the data.

I have to do selectNodes, so that I can dynamically change the "source" that I am searching on.
otherwise I would do it inside the XSL.

First code snippet is xmlretrieve.asp
step one, I retrieve a token from the api from
I then insert that token into a url string, to retrieve the actual data I want to manipulate.
I then load it as an xmldom, and view the data without parsing it.  This works fine, and will output as expected. ' I did this for testing purposes
however when I then do a selectnodes on it.
and then attempt the transform, I get the following error.
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'transformNode'
/xmlretrieve.asp, line 106

any thoughts?

Response.Expires = -1
Dim Token
token= "" 

Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
xmlHttp.Open "GET", token, false
RSSXML = xmlHttp.ResponseText

Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0")
xmlDOM.async = False
xmlDOM.validateOnParse = False
xmlDom.resolveExternals = False

If not xmlDOM.LoadXml(RSSXML) Then
ErrorMessage = "Can not load XML:" & vbCRLF & xmlDOM.parseError.reason & vbCRLF & ErrorMessage
End If

Set TokenGet = xmlDOM.getElementsByTagName("sid")
TokenGetCount = TokenGet.Length-1

For i = 0 To TokenGetCount
Set TokenGet = TokenGet.Item(i)

for each child in TokenGet.childNodes

TokenAuth = child.text

dim urlrequest
dim status2
dim strEMail
Dim objXML
Dim objNode
Dim objXSL

urlrequest= "" & TokenAuth & "&op=leads.retrieve"
xmlhttp.Open "GET", urlrequest, false
If xmlHttp.Status = 200 Then
    Set oResponseXML = xmlHttp.ResponseXML 'Save XML to an object
    bXMLLoadError = False
	 Response.Write("status="&xmlhttp.status & "<br>")
	Response.Write("<font color=""red"">Page Error: unknown Could not load XML from remote server</font><br>") 
	 bXMLLoadError = True
End If

Set xmlHttp = Nothing ' clear HTTP object


'Initialise variables
' Attempting to actually retrieve the leads at this point.
Dim oResponseXML
Dim bXMLLoadError
Dim whoIwant


If Not bXMLLoadError Then

    'Load the XML from the oResponseXML object
    set oXML = Server.CreateObject("Microsoft.XMLDOM")
    oXML.Async = false

Set objNode = oXML.SelectNodes("API/leads/leads_item[source_id='Other']") ' at least four records contain Other

    'Load the XSL from disk   
   set oXSL = Server.CreateObject("Microsoft.XMLDOM")
   oXSL.Async = False
  ' This works as long as the other transform is commented out.
  Response.Write(oXML.transformNode(oXSL)) 'Transform the XML using the XSL stylesheet 

set oXSL2 = Server.CreateObject("Microsoft.XMLDOM")
 If objNode.length > 1 Then ' test to see if obj.Node has any data in it.

  set oXSL2 = Server.CreateObject("Microsoft.XMLDOM")
   oXSL2.Async = False
   oXSL2.Load(Server.MapPath("leads_retrieve2.xsl")) ' customized XSL file for the transofrm

   ' I have tried this  no go text not support
'For Each Node In objNode
'Document.Write(objNode.text) & "<br />" 

 Response.Write(objNode.transformNode(oXSL2)) 'Transform the XML using the XSL stylesheet

 Response.Write("I got to here") ' step over test


 Response.Write("No Leads to Return")
 End If

End If


Open in new window

<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="leads_xml.xml" -->
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system=""/>
<xsl:template match="API/leads">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Leads Retrieve NodeSelect</title>
<table border="1">
<tr bgcolor="#eeeeee">
<th align="left">Account Name</th>
<th align="left">source_id</th>
<xsl:for-each select="leads_item">
<td><xsl:value-of select="account_name"/></td>
<td><xsl:value-of select="source_id"/></td>

Open in new window

Who is Participating?
Carl TawnConnect With a Mentor Systems and Integration DeveloperCommented:
You don't need to do a SelectNodes call first. The XSL Transform acts on the whole document. If you want to filter and only display certain elements from your XML document then you need to build that logic into your transform.
Carl TawnSystems and Integration DeveloperCommented:
You're trying to call transformNode on an IXMLNode object, which is invalid. You have to call it on the Document object itself.
Cmedic_techsAuthor Commented:

 Response.Write(objNode.transformNode(oXSL2)) 'Transform the XML using the XSL stylesheet

the document object being?  I'm sorry but little new to this, I've slowly built this through various examples out there on the web, and I'll admit, I have not reached full comprehension yet.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Carl TawnSystems and Integration DeveloperCommented:
oXML is the document object which holds your XML.
oXSL is also a document object, which in your code holds your XSL document.

SelectSingleNode and SelectNodes both return node objects, which represent elements within the document, rather than the whole document itself.
Cmedic_techsAuthor Commented:
Alright that makes sense, so now I will research based on that, and see if I can figure out how to transform after a SelectNodes is used.

cross your fingers, I've been trying to get past this point for over ten hours already.
Cmedic_techsAuthor Commented:
Set objNode = oXML.SelectNodes("API/leads/leads_item[source_id='Other']")

I need to output this result, hopefully using a xsl stylesheet.
as embededd above.
Cmedic_techsAuthor Commented:
anyhow.  I'm going to give you the points.  since you responded. and I didn't clarify why I needed to do the SelectNodes in the manner that I was.

but what I was trying to accomplish, is this, and I'm terrible sometimes at writing this out.

client logins.
retrieve leads from remote api in xml format.
select only those leads_items that correspond to that client.
output in a table, the data in that node.
since I can't put asp in the xsl.
I had act on the data prior to the xsl.

I have since found another way to do it that is working.  so thanks anyways.

Cmedic_techsAuthor Commented:
it wasn't actually a solution, it was more a what you were doing wrong, without an example of what to do to resolve it
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.