transform Method1
Starts the transformation process or resumes a previously failed transformation.
JScript Syntax
boolValue = objXSLProcessor.transform();
Example
var xslt = new ActiveXObject("Msxml2.XSLTemplate.6.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.6.0");
var xslProc;
xslDoc.async = false;
xslDoc.load("sample2.xsl");
if (xslDoc.parseError.errorCode != 0) {
var myErr = xslDoc.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
xslt.stylesheet = xslDoc;
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
var myErr = xmlDoc.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
WScript.Echo(xslProc.output);
}
}
Resource File
The JScript example uses the following file.
Sample2.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:param name="param1"/>
<xsl:template match="/">
Hello
</xsl:template>
<xsl:template match="/" mode="edit">
In Edit Mode
</xsl:template>
<xsl:template match="/" mode="view">
In View Mode
</xsl:template>
</xsl:stylesheet>
Output
Hello
C/C++ Syntax
HRESULT transform (VARIANT_BOOL* pDone);
Parameters
pDone[out, retval]
The returned success message.
Return Values
E_FAIL
The value returned if the value of the readyState
property is not READYSTATE_LOADED
or READYSTATE_COMPLETE
, or if a transformation error is encountered, for example, a script engine error.
VARIANT_FALSE
The value returned if the end of the input tree is reached and more input is pending.
VARIANT_TRUE
The value returned if the entire transformation is completed successfully.
Remarks
When the end of the transformation is reached successfully, VARIANT_TRUE
is returned.
Versioning
Implemented in: MSXML 3.0 and MSXML 6.0