Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-10
2
Medium Priority
?
474 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
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

916 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