Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

ownerTemplate Property

Returns the style sheet template that was used to create IXSLProcessor.

[Script]

Script Syntax

var objXSLTemplate = objXSLProcessor.ownerTemplate;

Example

var xslt = new ActiveXObject5.0("Msxml2.XSLTemplate.5.0");
var xslDoc = new ActiveXObject5.0("Msxml2.FreeThreadedDOMDocument.5.0");
var xslProc;
xslDoc.async = false;
xslDoc.load("sample2.xsl");
if (xmlDoc.parseError.errorCode <> 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   xslt.stylesheet = xslDoc;
   xslProc = xslt.createProcessor();
   alert(xslProc.ownerTemplate.stylesheet.xml);
}

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>
[Visual Basic]

Visual Basic Syntax

Set objXSLTemplate = objXSLProcessor.ownerTemplate

Example

Dim xslt As New Msxml2.XSLTemplate50
Dim xslDoc As New Msxml2.FreeThreadedDOMDocument50
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
   Set xslProc = xslt.createProcessor()
   MsgBox xslProc.ownerTemplate.stylesheet.xml
End If

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++]

C/C++ Syntax

HRESULT get_ownerTemplate (IXSLTemplate** ppTemplate);

Parameters

ppTemplate [out, retval]
The returned style sheet template property.

Remarks

The processor keeps the template active, so even if the user releases the template, this property can still be used to return the original template object.

Note   The stylesheet property on the returned template may be different from the stylesheet property.

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Applies to: IXSLProcessor