?
Solved

How can i use createProcessor when i transform using transformNodeToObject method.

Posted on 2003-11-10
2
Medium Priority
?
462 Views
Last Modified: 2012-05-04

I'm getting [object Error]  error on followinh line
Processor.transformNodeToObject(gxslDOM, result);

------------------------------------------------------------------------
var gxmlDOM = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0");
gxmlDOM.async = false;
gxmlDOM.loadXML(XML);


var gxslDOM = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0");
gxslDOM.async = false;
gxslDOM.loadXML(XSL);


var gTemplate = Server.CreateObject("MSXML2.XSLTemplate.3.0");
gTemplate.stylesheet = gxslDOM;

var Processor = gTemplate.createProcessor();
Processor.input = gxmlDOM;
Processor.addParameter("MENU", "NO", "");
Processor.addParameter("MENU1", "YES", "");


// Set up the resulting document.
var result = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0");
result.async = false;
result.validateOnParse = true;

// Parse results into a result DOM Document.
Processor.transformNodeToObject(gxslDOM, result);

Response.Write("result<BR>")

----
Following code works fine but i want to use transformNodeToObject instead of transform

....
....
// Parse results into a result DOM Document.
Processor.transform();
var strResult;
strResult = Processor.output;
return (strResult);
0
Comment
Question by:Bharat Guru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 26

Accepted Solution

by:
rdcpro earned 200 total points
ID: 9724232
transformNodeToObject() is a method of the IXMLDOMNode interface, not the template processor interface.  You can't use transformNodeToObject() on IXSLTemplate.   And you can't use parameters on transformNodeToObject()

Why would you want to do this anyway?  The transform() method does exactly what you want.  Note, I modified your code slightly:
============================================
// Don't need free threaded for this one, unless you're caching in an Application object or something
var gxmlDOM = Server.CreateObject("Msxml2.DOMDocument.3.0");
gxmlDOM.async = false;
gxmlDOM.loadXML(XML);

var gxslDOM = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0");
gxslDOM.async = false;
gxslDOM.loadXML(XSL);

// Set up the resulting document.  It doesn't need to be free threaded either
var result = Server.CreateObject("Msxml2.DOMDocument.3.0");
result.async = false;
// is this really necessary??  If you're doing the transform, are you *sure* the output is valid?
// result.validateOnParse = true;


var gTemplate = Server.CreateObject("MSXML2.XSLTemplate.3.0");
gTemplate.stylesheet = gxslDOM;

var Processor = gTemplate.createProcessor();
Processor.input = gxmlDOM;
// Set the output property to point to the XML target.  This has the same effect as transformNodeToObject
Processor.output = result
Processor.addParameter("MENU", "NO", "");
Processor.addParameter("MENU1", "YES", "");

Processor.transform()

// now result contains the output of the transform.
// if you wanted to send the output to the client, just use:

var Processor = gTemplate.createProcessor();
Processor.input = gxmlDOM;
Processor.output = Response
Processor.addParameter("MENU", "NO", "");
Processor.addParameter("MENU1", "YES", "");
Processor.transform()
=====================================

Again, if the intent is to send the result to the Response, don't use Response.Write.  Set the output to the Response object so that the result of the transform uses IStream to the Response object directly.

Regards,
Mike Sharp

0
 

Author Comment

by:Bharat Guru
ID: 10274178
thanks
0

Featured Post

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question