Processes this node and its children using the supplied XSL style sheet and returns the resulting transformation.
oXMLDOMNode.transformNodeToObject(stylesheet, outputObject)
HRESULT transformNodeToObject( IXMLDOMNode *stylesheet, VARIANT outputObject);
The stylesheet parameter must be either an IXMLDOMDocument node, in which case the document is assumed to be an XSL style sheet, or a DOM node in the XSL style sheet, in which case this node is treated as a stand-alone style sheet fragment.
The source node defines a context for the stylesheet to operate on, but navigation outside this scope is allowed. For instance, a stylesheet could use the id Function to access other parts of the document.
This method supports both stand-alone and embedded style sheets and also provides the ability to run a localized style sheet fragment against a particular source node.
The transformNodeToObject method always generates a Unicode byte-order mark, which means it cannot be used in conjunction with other ASP Response.Write or Response.BinaryWrite calls.
For more information about XSLT, see the XSLT Reference.
This example sets up the new DOMDocument object and puts it into a VARIANT before making the call to transformNodeToObject.
// p is the XML source that is to be transformed, pXSL is the style sheet. // Create an empty DOM document for the result. (Error checking omitted // for brevity.) hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&pDoc); hr = pDoc->QueryInterface(IID_IDispatch, (void **)&pDisp); vObject.vt = VT_DISPATCH; // the new object vObject.pdispVal = pDisp; hr = p->transformNodeToObject(pXSL, vObject); // Transformation is // present in pDoc.
IXMLDOMNode Interface | Using the XSLT Processor