473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Im experiencing strange xml transform problems

When I call the transformnode on my xml object like this:
response.write xmlobj.transformnode(xsl) I get the actual xsl sent to
the browser.

Here is my code:

<%@LANGUAGE="VBSCRIPT"%>

<%
Dim xmlhttp, xsldoc, xmldoc
set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", "http://some-server.com/xmlfile", false
xmlhttp.send

set xsldoc = Server.CreateObject("Microsoft.XMLDOM")
xsldoc.async = false
xsldoc.load(Server.MapPath("stylesheet.xsl"))

set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
xmldoc.async = false
xmldoc.loadXML(xmlhttp.responseText)

response.write xmldoc.transformNode(xsldoc)
%>

No error message is sent back from the object, I just get the xsl if I
view the source.

I have tried to call a newer xml object but this appears to be the only
accessible to me on the server.

Jul 22 '05 #1
7 1762


frustratedcoder wrote:

Dim xmlhttp, xsldoc, xmldoc
set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", "http://some-server.com/xmlfile", false
xmlhttp.send

set xsldoc = Server.CreateObject("Microsoft.XMLDOM")
xsldoc.async = false
xsldoc.load(Server.MapPath("stylesheet.xsl"))

set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
xmldoc.async = false
xmldoc.loadXML(xmlhttp.responseText)
Make those three lines
Set xmldoc = xmlhttp.responseXML
response.write xmldoc.transformNode(xsldoc)
Use
xmldoc.transformNodeToObject(xsldoc, Response)
instead.
Of course depending on what kind of content your XSL stylesheet creates
you need to set
Response.ContentType
appropriately.
No error message is sent back from the object, I just get the xsl if I
view the source.


There are several things that can go wrong, check
xmlhttp.status
to be 200, check whether xsldoc.load return true so that you know that
the stylesheet is well-formed.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 22 '05 #2
Thank you for the reply. I changed my code into:
Dim xmlhttp, xsldoc, xmldoc
set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", "http://www.somesite.com/xml", false
xmlhttp.send

set xsldoc = Server.CreateObject("Microsoft.XMLDOM")
xsldoc.async = false
xsldoc.load(Server.MapPath("stylesheet.xsl"))

set xmldoc = xmlhttp.responseXML

response.ContentType = "text/html"

xmldoc.transformNodeToObject xsldoc, Response

The xsl's output method is set to html, but the result is the same: I
get the xslt when I check the source.

Jul 22 '05 #3
frustratedcoder wrote:
Thank you for the reply. I changed my code into:
Dim xmlhttp, xsldoc, xmldoc
set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")

You should use the "Server" version of the XMLHTTP object. Also, I usually
am a little bit more explicit in my server-side code:

set xmlhttp = Server.CreateObject("msxml2.ServerXMLHTTP")

xmlhttp.open "GET", "http://www.somesite.com/xml", false
xmlhttp.send

Don't create and load your "xsl" document until you have verified that you
have received something from your xmlhttp request. I am going to rearrange
things now

set xmldoc = xmlhttp.responseXML
First debugging step:

response.ContentType = "text/xml"
xmldoc.save Response
Response.End

If all looks well when you run the page, comment out the above lines. I
would still add something like:

If len(xmldoc.xml) > 0 then
set xsldoc = Server.CreateObject("Microsoft.XMLDOM")
set xsldoc = Server.CreateObject("msxml2.DomDocument")
xsldoc.async = false
xsldoc.load(Server.MapPath("stylesheet.xsl"))

response.ContentType = "text/html"

xmldoc.transformNodeToObject xsldoc, Response
else
response.write "No xml was returned"
end if

The xsl's output method is set to html, but the result is the same: I
get the xslt when I check the source.


Try "text/xml"

Also, if you have "on error resume next" anywhere, comment it out.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #4
Thank you for the reply.

The msxml2.ServerXMLHTTP is not available on the server, only xmlhttp
and xmldom are available.

Jul 22 '05 #5
frustratedcoder wrote:
Thank you for the reply.

The msxml2.ServerXMLHTTP is not available on the server, only xmlhttp
and xmldom are available.


Sounds as if that's the issue then. Can they install the latest version of
the MSXML Parser on the server?

In the meantime, have you tried my other debugging suggestions? What result
did you get from them?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #6

frustratedcoder wrote:
The msxml2.ServerXMLHTTP is not available on the server, only xmlhttp
and xmldom are available.


What server is that? Old versions of MSXML as installed on Win 98 or
2000 do not support XSLT 1.0 at all, you need to have at least MSXML 3
(which is installed by IE 6) to do XSLT 1.0 transformations.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 22 '05 #7
I called the host provider yesterday and they confirmed that this was
an error and that they would upgrade.

Thank you all for your help.

Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Federico | last post by:
Hi all, I don't know if this topic is perhaps a little bit off-topic, anyway I have a strange problem in transforming an XML file in an HTML file using XSLT form a Java program written with...
0
by: matatu | last post by:
Hi to all, my program java applies some trasforms xslt to a file xml using the attribute encoding = "ISO-8859-1": it work fine under windows xp, but if I run the program on a pc with redhat ES...
0
by: Xiaolei Li | last post by:
first off, i'm a total newbie at this stuff so excuse any wrong usage of terminology or whatever else. i have a XSL to transform a Document such that all "text" nodes will have a "SPAN" inserted...
2
by: N. Demos | last post by:
I'm having problems with a custom JS object (XMLLoadObject) I designed to load XML and XSL files, perform an XSL transform with them and embed the resultant HTML fragment into the host HTML...
9
by: Patrick Guio | last post by:
Dear all, I am trying to use the std::transform algorithm to to the following vector< vector<char> >::iterator ik = keys.begin(); // key list iterator vector< vector<char> >::iterator is = ik;...
4
by: badbetty | last post by:
Hello and thank you for reading on (hopefully). How does one typecast the XMLREADER returned from the XSLTRANSFORM method 'transform' into XMLTEXTREADER, so it can be passed in to an...
2
by: Greg Merideth | last post by:
I have an XSL file that I am using to transform some XML data using this method below. The problem is that if I use an embedded .XSL file in the .NET assembly, I get an error indicating that the...
9
by: Doug Stiers | last post by:
I have this vb.net (framework 1.1) code: Dim x As Xml.Xsl.XslTransform = New Xml.Xsl.XslTransform Dim xr As XmlResolver MessageBox.Show("before load") x.Load(<xsl file name>) -- THIS IS WHERE...
1
by: Mike Hofer | last post by:
I've got two statements in my code that are both generating weird, weird, weird messages: The first one was, Dim document As System.Xml.XmlDocument Dim navigator As...
8
by: Paulo da Silva | last post by:
Hi! Why doesn't this work? If I change the name of the vector toLower for ex. to toLowerV it works! (GCC) Thanks. Paulo ..h _______________
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.