System.Xml.Xsl.XslTransform.Load Method

Loads the XSLT style sheet contained in the System.Xml.XPath.IXPathNavigable. This method allows you to limit the permissions of the style sheet by specifying evidence.

Syntax

public void Load (System.Xml.XPath.IXPathNavigable stylesheet, System.Xml.XmlResolver resolver, System.Security.Policy.Evidence evidence)

Parameters

stylesheet
An object implementing the System.Xml.XPath.IXPathNavigable interface. In the .NET Framework, this can be either an System.Xml.XmlNode (typically an System.Xml.XmlDocument), or an System.Xml.XPath.XPathDocument containing the XSLT style sheet.
resolver
The System.Xml.XmlResolver used to load any style sheets referenced in xsl:import and xsl:include elements. If this is null, external resources are not resolved.
evidence
The System.Security.Policy.Evidence set on the assembly generated for the script block in the XSLT style sheet.

Remarks

Note:

The System.Xml.Xsl.XslTransform class is obsolete in the .NET Framework version 2.0. The System.Xml.Xsl.XslCompiledTransform class is the new XSLT processor. For more information, see Using the XslCompiledTransform Class and Migrating From the XslTransform Class.

System.Xml.Xsl.XslTransform supports the XSLT 1.0 syntax. The XSLT style sheet must include the namespace declaration xmlns:xsl= http://www.w3.org/1999/XSL/Transform.

For issues with the erload:System.Xml.Xsl.XslTransform.Load method and style sheets with embedded scripts, see article Q316755 in the Microsoft Knowledge Base at http://support.microsoft.com.

There are different ways to provide evidence. The following table describes what type of evidence to provide for common user scenarios.

The XSLT style sheet is self-contained or comes from a code base that you trust.

Use the evidence from your assembly.

Example

XsltTransform xslt = new XslTransform();
xslt.Load(style sheet, resolver, this.GetType().Assembly.Evidence);
The XSLT style sheet comes from an outside source. The origin of the source is known, and there is a verifiable URL.

Create evidence using the URL.

Example

XsltTransform xslt = new XslTransform();
Evidence evidence = XmlSecureResolver.CreateEvidenceForUrl(style sheetURL);
xslt.Load(style sheet,resolver,evidence);
The XSLT style sheet comes from an outside source. The origin of the source is not known.

Set evidence to null. Script blocks are not processed, the XSLT document() function is not supported, and privileged extension objects are disallowed.

Additionally, you can also set the resolver parameter to null. This ensures that xsl:import and xsl:include elements are not processed.

The XSLT style sheet comes from an outside source. The origin of the source is not known, but you require script support.

Request evidence from the caller. The API of the caller must provide a way to provide evidence, typically the System.Security.Policy.Evidence class.

Requirements

Namespace: System.Xml.Xsl
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0