Export (0) Print
Expand All

XsltSettings Constructor (Boolean, Boolean)

Initializes a new instance of the XsltSettings class with the specified settings.

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

public XsltSettings(
	bool enableDocumentFunction,
	bool enableScript
)

Parameters

enableDocumentFunction
Type: System.Boolean

true to enable support for the XSLT document() function; otherwise, false.

enableScript
Type: System.Boolean

true to enable support for embedded scripts blocks; otherwise, false.

Security noteSecurity Note

XSLT scripting should be enabled only if you require script support and you are working in a fully trusted environment. If you enable the document() function, you can restrict the resources that can be accessed by passing an XmlSecureResolver object to the Transform method.

The following example loads a style sheet and enables XSLT script support.

// Create the XsltSettings object with script enabled.
XsltSettings settings = new XsltSettings(false,true);

// Create the XslCompiledTransform object and load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("sort.xsl", settings, new XmlUrlResolver());

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft