Solved

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

Posted on 2003-11-10
2
453 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 50 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

690 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