Processes this node and its children using the supplied XSL Transformations (XSLT) style sheet and returns the resulting transformation.
strValue = oXMLDOMNode.transformNode(objStylesheet);
A string. Returns a string that contains the product of the transformation of this XML document based on the XSLT style sheet.
The following Microsoft® JScript® example fills an HTML DIV
tag with the result of transformNode
.
<SCRIPT> // Load data. var source = new ActiveXObject("Msxml2.DOMDocument.5.0"); source.async = false; source.load("books.xml"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { // Load style sheet. var stylesheet = new ActiveXObject("Msxml2.DOMDocument.5.0"); stylesheet.async = false stylesheet.load("sample.xsl"); if (xmlDoc.parseError.errorCode <> 0) { var myErr = xmlDoc.parseError; alert("You have error " + myErr.reason); } else { // Fill a div tag with the result of the transform divInfo.innerHTML = source.transformNode(stylesheet); } } } </SCRIPT>
strValue = oXMLDOMNode.transformNode(objStylesheet)
A string. Returns a string that contains the product of the transformation of this XML document based on the XSLT style sheet.
The following Microsoft® Visual Basic® example displays the result of transformNode
.
Dim source As New Msxml2.DOMDocument50 Dim stylesheet As New Msxml2.DOMDocument50 ' Load data. source.async = False source.Load "books.xml" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else ' Load style sheet. stylesheet.async = False stylesheet.Load "sample.xsl" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else ' Do the transform. MsgBox source.transformNode(stylesheet) End If End If
HRESULT transformNode( IXMLDOMNode *stylesheet, BSTR *xmlString);
stylesheet
or xmlString
parameter is Null.The stylesheet
parameter must be either a DOMDocument
node, in which case the document is assumed to be an Extensible Stylesheet Language (XSL) style sheet, or a Document Object Model (DOM) node in the XSL style sheet, in which case this node is treated as a standalone style sheet fragment.
The source node defines a context in which the style sheet operates, but navigation outside this scope is allowed. For example, a style sheet can use the id
function to access other parts of the document.
This method supports both standalone and embedded style sheets and also provides the ability to run a localized style sheet fragment against a particular source node.
This member is an extension of the World Wide Web Consortium (W3C) DOM.
For more information about XSLT style sheets, see the XSLT Reference.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
Using XSLT with DOM or SAX | id Function
Applies to: IXMLDOMAttribute | IXMLDOMCDATASection | IXMLDOMCharacterData | IXMLDOMComment | DOMDocument | IXMLDOMDocumentFragment | IXMLDOMDocumentType | IXMLDOMElement | IXMLDOMEntity | IXMLDOMEntityReference | IXMLDOMNode | IXMLDOMNotation | IXMLDOMProcessingInstruction | IXMLDOMText