Partager via


setStartMode Method

 

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, "".

JScript Syntax

objXSLProcessor.setStartMode(mode, namespaceURI);  

Parameters

mode
The desired mode as a string. It must be the base name part of the qualified name.

namespaceURI(optional)
The full namespace URI to fully qualify the start mode name.

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");
xslt.stylesheet = xslDoc;
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
xmlDoc.async = false;
xmlDoc.load("books.xml");
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.setStartMode("view");
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

In View Mode

C/C++ Syntax

HRESULT setStartMode(BSTR mode, BSTR namespaceURI);  

Parameters

mode[in]
The desired mode as a string. It must be the base name part of the qualified name.

namespaceURI[in, optional]
The full namespace URI to fully qualify the start mode name.

Return Values

S_OK
Success

E_FAIL
The value returned if the value of the readyState property is READYSTATE_INTERACTIVE.

E_INVALIDARG
The value returned if the mode base name contains a colon character or is an invalid name.

Remarks

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>  

Versioning

Implemented in: MSXML 3.0 and MSXML 6.0

See Also

IXSLProcessor