Load Method (XmlReader, XmlResolver)

XslTransform.Load Method (XmlReader, XmlResolver)

.NET Framework 1.1
NOTE: This member is now obsolete.
You should pass evidence to Load() method

Loads the XSLT stylesheet contained in the XmlReader.

[Visual Basic]
<Obsolete("You should pass evidence to Load() method", False)>
Overloads Public Sub Load( _
   ByVal stylesheet As XmlReader, _
   ByVal resolver As XmlResolver _
[Obsolete("You should pass evidence to Load() method", false)]
public void Load(
 XmlReader stylesheet,
 XmlResolver resolver
[Obsolete("You should pass evidence to Load() method", false)]
public: void Load(
 XmlReader* stylesheet,
 XmlResolver* resolver
   Obsolete("You should pass evidence to Load() method", false)
function Load(
 stylesheet : XmlReader,
 resolver : XmlResolver


An XmlReader object that contains the XSLT stylesheet.
The XmlResolver used to load any stylesheets referenced in xsl:import and xsl:include elements. If this is a null reference (Nothing in Visual Basic), external resources are not resolved.

The XmlResolver is not cached after the Load method completes.


Exception Type Condition
XsltCompileException The current node does not conform to a valid stylesheet.
SecurityException The stylesheet contains embedded scripts and the caller does not have UnmanagedCode permission.


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

This method loads the XSLT stylesheet including any stylesheets referenced in xsl:include and xsl:import elements. The stylesheet loads from the current node of the XmlReader through all its children. This enables you to use a portion of a document as the stylesheet.

After the Load method returns, the XmlReader is positioned on the next node after the end of the stylesheet. If the end of the document is reached, the XmlReader is positioned at the end of file (EOF).

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

Note   This method is obsolete in version 1.1 of the .NET Framework. The recommended practice is to is to provide evidence using the Load overload that takes a System.Security.Policy.Evidence object as one of its arguments. If you use this method, stylesheets containing embedded scripts are handled in the following manner. If the stylesheet contains embedded scripting, the script is compiled to an assembly. The assembly has full trust. If the caller does not have UnmanagedCode permission, the embedded script is not compiled and a SecurityException is thrown. See SecurityPermission and SecurityPermissionFlag.UnmanagedCode for more information.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

XslTransform Class | XslTransform Members | System.Xml.Xsl Namespace | XslTransform.Load Overload List | XmlResolver.Credentials | CredentialCache | NetworkCredential

© 2016 Microsoft