Caliing asp as xslt

J

Justin Woodcock

Hi,

Is it possible to call an asp file that generates xslt using

Objectname.load ? I have tried this script :

<%

Dim objXML, objXSL

Set objXML = Server.CreateObject("Msxml2.DOMDocument.4.0")

Set objXSL = Server.CreateObject("Msxml2.DOMDocument.4.0")

objXML.async = False

objXSL.async = False

objXML.setProperty "ServerHTTPRequest", true

objXML.load

("http://www.ourdomain.com/sales/atdxmlfeed.asp?Ga_Id=" &

Request("Ga_Id") )

objXSL.setProperty "ServerHTTPRequest", true

objXSL.load "http://www.ourdomain.com/sales/stylesheet01.asp?Ga_Id=" &
Request("Ga_Id") ) **** this is the line with the problem....

objXML.transformNodeToObject objXSL, Response

%>

But when I run it on the browser, I get this error :

******

msxml4.dll error '80004005'

The stylesheet does not contain a document element. The stylesheet may be
empty, or it may not be a well-formed XML document.

********

When I change stylesheet01.asp to stylesheet01.xsl (stripping the asp out),
it works. The xml file (atdxmlfeed.asp) works too, and I assumed that what
would be good for one, would be good for the other.

Thanks in advance for any advice received.

Justin Woodcock
 
A

Andy Dingley

Justin Woodcock said:
Is it possible to call an asp file that generates xslt using
Objectname.load

That's trying to load XSLT, rather than generate it, but yes, it ought
to work.

XSLT is just XML. XML (in the right place) is just HTTP traffic. It
all inter-works quite cheerfully.

Dim objXML, objXSL

Don't use VBScript, use JScript. It's worth learning it, just for the
better error trapping.

objXML.async = False

Good. This is popular bug #1

This line is ugly.

Don't assemble strings dynamically and use them immediately until
_after_ you've debugged it.

Grabbing random stuff out of Request.QueryString() is tacky. There
could be anything in there - embedded SQL, redirects to other sites,
all sorts of nastiness.

Write yourself a nice tidy little parameter reading library and _USE_
it, even for hack-code written during prototyping (for we know how
this stuff becomes immortal).

If any of my code-bunnies use QueryString() in-line on a page, then I
break their fingers.



objXSL.load "http://www.ourdomain.com/sales/stylesheet01.asp?Ga_Id=" &
Request("Ga_Id") ) **** this is the line with the problem....

Is it ?

But when I run it on the browser,

browser ?


******

msxml4.dll error '80004005'

The stylesheet does not contain a document element. The stylesheet may be
empty, or it may not be a well-formed XML document.

********

So what _does_ the stylesheet contain ? Did the .load() method
succeed or fail? If it did succeed, what did it manage to load ? Does
it look like a stylesheet?

If you answer this, I imagine you'll answer your own problem.


Then write a nice error-dump routine and call it every time you do a
..load() or similar. Show you the bad XML, and where it went bad.


I'm a furniture maker who also happens to write code. In one trade I
spent an hour a day just sharpening tools, then I do some good work. I
know that work with blunt tools will be a complete waste of effort, so
I don't do it. In the other trade I don't get to sharpen anything
because "There's no time! We have to write code now!". Funny
that....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top