XslCompiledTransform.Load Method (IXPathNavigable, XsltSettings, XmlResolver)
Compiles the XSLT style sheet contained in the IXPathNavigable. The XmlResolver resolves any XSLT import or include elements and the XSLT settings determine the permissions for the style sheet.
Namespace: System.Xml.Xsl
Assembly: System.Xml (in System.Xml.dll)
public void Load( IXPathNavigable stylesheet, XsltSettings settings, XmlResolver stylesheetResolver )
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.
- settings
- Type: System.Xml.Xsl.XsltSettings
The XsltSettings to apply to the style sheet. If this is null, the Default setting is applied.
- stylesheetResolver
- Type: System.Xml.XmlResolver
The XmlResolver used to resolve any style sheets referenced in XSLT import and include elements. If this is null, external resources are not resolved.
| Exception | Condition |
|---|---|
| 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.
The following example loads a style sheet. The XmlSecureResolver object contains the credentials necessary to access any import or include elements found in the style sheet.
// Create a resolver and specify the necessary credentials. XmlUrlResolver resolver = new XmlUrlResolver(); System.Net.NetworkCredential myCred; myCred = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain); resolver.Credentials = myCred; // Load the style sheet. XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(new XPathDocument("http://serverName/data/xsl/sort.xsl"), XsltSettings.Default, resolver);
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.