output Property
Gets a custom output to write the result of the transformation.
Script Syntax
output = objXSLProcessor.output; objXSLProcessor.output (output);
Parameters
- output
- The object to which to write the output of the transformation.
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; var xmlDoc = new ActiveXObject5.0("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.transform(); alert(xslProc.output); } }
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 Syntax
output = objXSLProcessor.output objXSLProcessor.output (output)
Parameters
- output
- The object to which to write the output of the transformation.
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 "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 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.Transform MsgBox xslProc.output 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++ Syntax
HRESULT get_output (VARIANT* pOutput); HRESULT put_output (VARIANT output);
Parameters
- pOutput [out, retval]
- The custom output object or a BSTR containing the transformation result.
- output [in]
- The object to write the output of the transformation to.
C/C++ Return Values
- E_NOINTERFACE
- Value returned if the given output object does not support a supported interface.
- E_FAIL
- Value returned if the
readyState
property is READYSTATE_INTERACTIVE.
Remarks
The output property can be any object/interface that supports IStream
, IPersistStream
, DOMDocument
, ASP IResponse
, ADODB.Stream
, or IMXWriter.
When a new transform
is started, the processor will use a QueryInterface
this output for IStream
. When the transform is complete or reset
is called, IStream
is released. The only method that is used on IStream
is Write
. The bytes written to the stream will be encoded according to the encoding attribute on the <xsl:output>
element.
If you do not provide a custom output, then you will get a string when you read this property. The string contains the incrementally buffered transformation result.
Reading this property has the side effect of resetting that internal buffer so that each time you read the property you get the next chunk of output. In this case, the output is always generated in the Unicode encoding, and the encoding attribute on the <xsl:output> element is ignored.
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
Applies to: IXSLProcessor