Hi guys
I've been given access to this information system.
I am writing an ASP application to interface with it.
It uses an API which talks in XML. Basically all requests to the API are made in XML. I use the MSXML2.ServerXMLHTTP component to post my XML request to it. I get a response back in the form of XML.
I have decided to use XSL to manipulate the XML into the existing HTML. However its actually getting it to work together i am having problems with.
here is my code:
Thats just a snippet of code responsible for doing this.
I get the following error when i run it:
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document
Here is my xsl code:
As you can see i have included this in the same page for testing purposes. I submitting this to the function i created to query the API and get a response. Then the function takes that response and tries to transform it.
any help on this would be greatly appreciated. until a day ago i didn't know anything about xml and spent a few hours doing a crash course in it! i understand not everyone will be familiar with the xsl, but if anyone has any info on it id like to hear from you.
Cheers!
I've been given access to this information system.
I am writing an ASP application to interface with it.
It uses an API which talks in XML. Basically all requests to the API are made in XML. I use the MSXML2.ServerXMLHTTP component to post my XML request to it. I get a response back in the form of XML.
I have decided to use XSL to manipulate the XML into the existing HTML. However its actually getting it to work together i am having problems with.
here is my code:
Code:
set objServerXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
objServerXML.Open "POST", xmlrequesturl, False
objServerXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objServerXML.Send xmlrequeststring
if objServerXML.status = 200 Then
Set objxml = Server.CreateObject("MSXML2.DOMDocument")
objxml.async = False
objxml.load(objServerXML.ResponseText)
Set objxsl = Server.CreateObject("MSXML2.DOMDocument")
objxsl.async = False
objxsl.load(xslstyle)
Response.Write objxml.transformnode(objxsl)
Thats just a snippet of code responsible for doing this.
I get the following error when i run it:
The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document
Here is my xsl code:
Code:
xsl1 = _
"<?xml version=""1.0"" encoding=""UTF-8""?> " & _
"<html xsl:version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns=""http://www.w3.org/1999/xhtml"">" & _
"<xsl:for-each select=""XMLRequest/SearchResults"">" & _
"<xsl:value-of select=""Business number"" />" & _
"<xsl:value-of select=""name"" />" & _
"<xsl:value-of select=""address"" />" & _
"<xsl:value-of select=""status"" />" & _
"<xsl:value-of select=""scoreAvailable"" />" & _
"</xsl:for-each>"
As you can see i have included this in the same page for testing purposes. I submitting this to the function i created to query the API and get a response. Then the function takes that response and tries to transform it.
any help on this would be greatly appreciated. until a day ago i didn't know anything about xml and spent a few hours doing a crash course in it! i understand not everyone will be familiar with the xsl, but if anyone has any info on it id like to hear from you.
Cheers!