stylesheet Property (IXSLTemplate)


Returns the Extensible Stylesheet Language (XSL) style sheet to compile into an XSL template.

var objXMLDOMNode = objXSLTemplate.stylesheet;  
objXSLTemplate.stylesheet = objXMLDOMNode;  


var xslt = new ActiveXObject("Msxml2.XSLTemplate.3.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.3.0");
var xslProc;
xslDoc.async = false;
if (xslDoc.parseError.errorCode != 0) {
   var myErr = xslDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
} else {
   xslt.stylesheet = xslDoc;

Set objXMLDOMNode = objXSLTemplate.stylesheet  
objXSLTemplate.stylesheet = objXMLDOMNode  

The Jscript example uses the following file.


<xsl:stylesheet xmlns:xsl="" version="1.0">
   <xsl:output method="html"/>
   <xsl:param name="param1"/>
  <xsl:template match="/">
  <xsl:template match="/" mode="edit">
      In Edit Mode
  <xsl:template match="/" mode="view">
      In View Mode

HRESULT get_stylesheet(IXMLDOMNode** stylesheet);  
HRESULT putref_stylesheet(IXMLDOMNode* stylesheet);  


stylesheet[out, retval][in]
The node that represents an XSL Transformations (XSLT) style sheet. This must be a free-threaded document object.

System_CAPS_ICON_note.jpg Note

In MSXML, "free-threaded" means ThreadingModel='Both', and cross-thread marshalling is supported.

C/C++ Return Values

The value returned if the document is not a valid style sheet or if the document is not free-threaded.

The style sheet document is made read-only while the style sheet belongs to the template or any associated processor. The read-only flag is removed when the style sheet is released from all templates and processors.

Because the processors created by this template take a snapshot of the current style sheet and always use it, they are not affected by changes to this stylesheet property. The only way to update the processor to the new style sheet is to create a new processor.

Implemented in:

MSXML 3.0, MSXML 6.0