XslCompiledTransform.Load Method (IXPathNavigable)

Compiles the style sheet contained in the IXPathNavigable object.

Namespace:  System.Xml.Xsl
Assembly:  System.Xml (in System.Xml.dll)

public void Load(
	IXPathNavigable stylesheet
)

Parameters

stylesheet
Type: System.Xml.XPath.IXPathNavigable

An object implementing the IXPathNavigable interface. In the Microsoft .NET Framework, this can be either an XmlNode (typically an XmlDocument), or an XPathDocument containing the style sheet.

ExceptionCondition
ArgumentNullException

The stylesheet value is null.

XsltException

The style sheet contains an error.

The XslCompiledTransform class supports the XSLT 1.0 syntax. The XSLT style sheet must use the http://www.w3.org/1999/XSL/Transform namespace.

This method has the following behavior:

  • An XmlUrlResolver with no user credentials is used to process any xsl:import or xsl:include elements.

  • The document() function is disabled.

  • Embedded scripts are not supported.

You can use the Load overload to specify an XmlResolver with the necessary authentication credentials, or to specify different XSLT settings.

The following example loads a style sheet contained in an XPathDocument object.

XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(new XPathDocument("http://serverName/data/xsl/sort.xsl"));

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft