createProcessor Method
Creates a rental-model IXSLProcessor object that will use this template.
var objXSLProcessor = objXSLTemplate.createProcessor();
Example
var xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0"); var xslProc; xslDoc.async = false; xslDoc.load("createProcessor.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.3.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.addParameter("param1", "Hello"); xslProc.transform(); WScript.Echo(xslProc.output); } }
The JScript and Visual Basic examples use the following file.
createProcessor.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="/"> The parameter value was: <xsl:value-of select="$param1"/> </xsl:template> </xsl:stylesheet>
The JScript and Visual Basic examples output the following.
The parameter value was: Hello
HRESULT createProcessor(IXSLProcessor** ppProcessor);
Parameters
ppProcessor[out, retval]
The returned processor associated with this template.
Return Values
E_OUTOFMEMORY
E_FAIL
The value returned if the template has no style sheet.
Multiple processors can be created from the same IXSLTemplate object.
Implemented in: MSXML 3.0 and MSXML 6.0
Show: