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.5.0"); var xslDoc = new ActiveXObject("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; alert(xslt.stylesheet.xml); }
File Name: 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>
Set objXMLDOMNode = objXSLTemplate.stylesheet objXSLTemplate.stylesheet = objXMLDOMNode
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 MsgBox xslt.stylesheet.xml End If
File Name: 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_stylesheet(IXMLDOMNode** stylesheet); HRESULT putref_stylesheet(IXMLDOMNode* stylesheet);
Note In MSXML, "free-threaded" means ThreadingModel='Both'
, and cross-thread marshalling is supported.
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.
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.
Applies to: IXSLTemplate