System.Xml.Xsl.XslTransform.Load Method

Loads the XSLT style sheet contained in the System.Xml.XmlReader.

Syntax

public void Load (System.Xml.XmlReader stylesheet)

Parameters

stylesheet
An System.Xml.XmlReader object that contains 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.

This method loads the XSLT style sheet, including any style sheets referenced in xsl:include and xsl:import elements. External resources are resolved using an System.Xml.XmlUrlResolver with no user credentials. If the style sheet(s) are located on a network resource which requires authentication, use the overload that takes an System.Xml.XmlResolver as one of its arguments and specify an System.Xml.XmlResolver with the necessary credentials.

The style sheet loads from the current node of the System.Xml.XmlReader through all its children. This enables you to use a portion of a document as the style sheet. After the erload:System.Xml.Xsl.XslTransform.Load method returns, the System.Xml.XmlReader is positioned on the next node after the end of the style sheet. If the end of the document is reached, the System.Xml.XmlReader is positioned at the end of file (EOF).

If the style sheet contains entities, you should specify an System.Xml.XmlReader that can resolve entities (System.Xml.XmlReader.CanResolveEntity returns true). In this case, an System.Xml.XmlValidatingReader can be used.

If the style sheet contains embedded scripting, the script is compiled to an assembly. The assembly has full trust. The recommended practice is to provide evidence using the XslTransform.Load(System.Xml.XmlReader, System.Xml.XmlResolver, System.Security.Policy.Evidence) method. 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.

Note:

If the caller does not have UnmanagedCode permission, the embedded script is not compiled and a System.Security.SecurityException is thrown. See System.Security.Permissions.SecurityPermission and System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode for more information.

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