Performs subsets of larger XSL Transformations (XSLT) by selecting the XSLT mode with which to start. This minimizes the amount of XSLT processing.
The default value of the start mode is the empty string, "".
var xslt = new ActiveXObject("Msxml2.XSLTemplate.5.0"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0"); var xslProc; xslDoc.async = false; xslDoc.load("sample2.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0"); xmlDoc.async = false; xmlDoc.load("books.xml"); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; xslProc.setStartMode("view"); xslProc.transform(); alert(xslProc.output);
File Name: 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>
objXSLProcessor.setStartMode(mode, namespaceURI);
objXSLProcessor.setStartMode(mode, namespaceURI)
Dim xslt As New Msxml2.XSLTemplate50 Dim xslDoc As New Msxml2.FreeThreadedDOMDocument50 Dim xmlDoc As New Msxml2.DOMDocument50 Dim xslProc As IXSLProcessor xslDoc.async = False xslDoc.Load "sample2.xsl" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set xslt.stylesheet = xslDoc xmlDoc.async = False xmlDoc.Load "books.xml" If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else Set xslProc = xslt.createProcessor() xslProc.input = xmlDoc xslProc.setStartMode "view" xslProc.Transform MsgBox xslProc.output End If End If
File Name: 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>
HRESULT setStartMode(BSTR mode, BSTR namespaceURI);
readyState
property is READYSTATE_INTERACTIVE
.Using setStartMode
is essentially the same as an XSLT style sheet that starts with the following rule.
<xsl:template match="/"> <xsl:apply-templates select="*" mode="{mode}"/> </xsl:template>
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.
Applies to: IXSLProcessor
W3C Qualified Names section of the XSLT Version 1.0 W3C Recommendation | W3C Namespaces in XML Recommendation