How can I reference Msxml2.XSLTemplate50 in vbscript?

C

Caeanis

I tried using the following code sample out of help.
Dim xslt As New Msxml2.XSLTemplate50
Dim xslDoc As Msxml2.FreeThreadedDOMDocument50
Dim xmlDoc As New Msxml2.DOMDocument50
Dim xslProc As IXSLProcessor

Problem is vbscript is not vb there for there must be a way to reference the
object by referencing the dll that it is found in. I thought that maybe
because it was inside my infopath doc it would be an intrinsic object. I
also tried using asp's method of

Set xslt = Server.CreateObject("Msxml2.XSLTemplate50")
Set xslDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument50")
Set xslProc = Server.CreateObject("IXSLProcessor")

But that doesn't work either since I'm not pulling this from a webserver.
How do I initialize these object in VbScript?
 
S

S.Y.M. Wong-A-Ton

A plain old "CreateObject" without the "Server" part should work if the DLL
is registered on your machine. So try using
Set xslt = CreateObject("Msxml2.XSLTemplate50")
 
C

Caeanis

Thank you for stating the obvious. I don't know why I didn't see it right
away. Now I have a new problem; the following line:

xslDoc.Load "myRecipes.xsl"

Generates this error at run-time:

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

!!!

I can use this same style sheet to successfully transform a xml document
generated by my infopath form in both Stylus Studio and Altova XMLSpy. I
have validated it in both for being well formed and all that jazz. So why
is InfoPath having an issue with it? Does it need a special tag(s) for
Infopath to use it?
 

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

Top