Partager via


startMode Property

 

Returns the base name part of the start mode, a qualified name.

Script Syntax

objXSLProcessor.startMode(mode);  

Example

var xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");
var xslProc;
xslDoc.async = false;
xslDoc.load("sample2.xsl");
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.setStartMode("view");
   WScript.Echo(xslProc.startMode);
}

Visual Basic Syntax

objXSLProcessor.startMode
(mode)  

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>

C/C++ Syntax

HRESULT startMode(BSTR mode);  

Parameters

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

C/C++ Return Values

E_FAIL
The value returned if readyState is READYSTATE_INTERACTIVE.

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

Remarks

The default value of startMode is the empty string, "".

By default, the starting mode for a new XSLT stylesheet is NULL and the startMode property returns the empty string ("") as its initial value. However, a user can use this property to read or change this value, which is the base name portion of a QName, so that it will work in connection with the mode attribute of xsl:template instructions. All templates with the same mode are grouped together. The xsl:apply-templates instruction also has a mode attribute that allows it to match and apply only those templates with the same mode.

For more information, see the Worldwide Web Consortium XSL Transformations (XSLT) Version 1.0 Recommendation at http://www.w3.org/TR/WD-xslt.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXSLProcessor