startModeURI Property

 

Returns the namespace URI part of the start mode, the qualified name.

strNamespace = objXSLProcessor.startModeURI;

This Jscript example uses a resource file, sample2.xsl, listed later in this topic.

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.startModeURI);
}

strNamespace = objXSLProcessor.startModeURI

The Jscript example uses the following resource 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>

HRESULT get_startModeURI(BSTR * namespaceURI);

 namespaceURI[out, retval]

The namespace URI of the starting Extensible Stylesheet Language (XSL) mode.

The default value of this property is the empty string, "".

By default, the starting mode for a new XSLT stylesheet is NULL and the startModeURI property returns the empty string ("") as its initial value. However, a user can use this property to read or change this value, which will set the namespace prefix to be applied to the base name specified in the startMode property. Together, these two values form a QName that can identify a starting mode. The start mode works 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 www.w3.org/TR/WD-xslt.

Implemented in:

MSXML 3.0, MSXML 6.0

         IXSLProcessor       

Show: