共用方式為


XsltSettings.TrustedXslt 屬性

定義

取得 XsltSettings 物件,此物件會啟用 XSLT document() 函式和內嵌指令碼區塊的支援。

public:
 static property System::Xml::Xsl::XsltSettings ^ TrustedXslt { System::Xml::Xsl::XsltSettings ^ get(); };
public static System.Xml.Xsl.XsltSettings TrustedXslt { get; }
member this.TrustedXslt : System.Xml.Xsl.XsltSettings
Public Shared ReadOnly Property TrustedXslt As XsltSettings

屬性值

XsltSettings

XsltSettingsEnableDocumentFunction 屬性設為 trueEnableScript 物件。

範例

下列範例會載入支援 XSLT document() 函式和內嵌腳本區塊功能的樣式表單。

// Create a resolver and specify the necessary credentials.
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://serverName/data/");
System.Net.NetworkCredential myCred;
myCred  = new System.Net.NetworkCredential(UserName,SecurelyStoredPassword,Domain);
resolver.Credentials = myCred;

// Create the XslCompiledTransform object and load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("http://serverName/data/script.xsl", XsltSettings.TrustedXslt, resolver);
' Create a resolver and specify the necessary credentials.
Dim resolver As New XmlSecureResolver(New XmlUrlResolver(), "http://serverName/data/")
Dim myCred As System.Net.NetworkCredential
myCred = New System.Net.NetworkCredential(UserName, SecurelyStoredPassword, Domain)
resolver.Credentials = myCred
        
' Create the XslCompiledTransform object and load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load("http://serverName/data/script.xsl", XsltSettings.TrustedXslt, resolver)

備註

重要

僅當需要指令碼支援且在完全受信任的環境中運作時,才應啟用 XSLT 指令碼。 如果啟用函 document() 式,您可以將 物件傳遞 XmlSecureResolverTransform 方法,以限制可存取的資源。

適用於

另請參閱