reset Method (IXSLProcessor)

MSXML 5.0 SDK

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

reset Method (IXSLProcessor)

Resets the state of the processor to the state it was in prior to calling the transform method.

[Script]

Script Syntax

objXSLProcessor.reset();

Example

var xslt = new ActiveXObject("Msxml2.XSLTemplate.5.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0");
var xslProc;
xslDoc.async = false;
xslDoc.load("sample.xsl");
if (xmlDoc.parseError.errorCode <> 0) {
   var myErr = xmlDoc.parseError;
   alert("You have error " + myErr.reason);
} else {
   xslt.stylesheet = xslDoc;
   var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.5.0");
   xmlDoc.async = false;
   xmlDoc.load("books.xml");
   if (xmlDoc.parseError.errorCode <> 0) {
      var myErr = xmlDoc.parseError;
      alert("You have error " + myErr.reason);
   } else {
      xslProc = xslt.createProcessor();
      xslProc.input = xmlDoc;
      xslProc.addParameter("param1", "Hello");
      xslProc.transform();
      alert(xslProc.output);
      xslProc.reset();
      alert(xslProc.output);
   }
}

Sample.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="/">
        The parameter value was: <xsl:value-of select="$param1"/>
   </xsl:template>
</xsl:stylesheet>
[Visual Basic]

Visual Basic Syntax

objXSLProcessor.reset

Example

Dim xslt As New Msxml2.XSLTemplate50
Dim xslDoc As New Msxml2.FreeThreadedDOMDocument50
Dim xmlDoc As New Msxml2.DOMDocument50
Dim xslProc As IXSLProcessor
xslDoc.async = False
xslDoc.Load "sample.xsl"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
Else
   Set xslt.stylesheet = xslDoc
   xmlDoc.async = False
   xmlDoc.Load "books.xml"
   If (xmlDoc.parseError.errorCode <> 0) Then
      Dim myErr
      Set myErr = xmlDoc.parseError
      MsgBox("You have error " & myErr.reason)
   Else
      Set xslProc = xslt.createProcessor()
      xslProc.input = xmlDoc
      xslProc.addParameter "param1", "Hello"
      xslProc.Transform
      MsgBox xslProc.output
      xslProc.Reset
      MsgBox xslProc.output
   End If
End If

Sample.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="/">
        The parameter value was: <xsl:value-of select="$param1"/>
   </xsl:template>
</xsl:stylesheet>
[C/C++]

C/C++ Syntax

HRESULT reset();

Remarks

It does not reset any other properties, such as stylesheet or startMode.

The reset method will cause any internally buffered output to be thrown away (that is, it aborts the asynchronous transformation). Calling reset results in the readyState value going from READYSTATE_INTERACTIVE back to READYSTATE_LOADED.

A re-entrant call to reset from inside the scope of a call to transform results in that transform call finishing as soon as it can, returning E_FAIL with the error message "User aborted transform."

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