共用方式為


XmlWebPart.Xsl property

取得或設定用來轉換網頁組件內容,如果沒有提供XslLink的內嵌的 XSLT。

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
<RequiresDesignerPermissionAttribute> _
<WebPartStorageAttribute(Storage.Shared)> _
<ResourcesAttribute("", "Advanced", "Xsl")> _
Public Property Xsl As XmlElement
    Get
    Set
'用途
Dim instance As XmlWebPart
Dim value As XmlElement

value = instance.Xsl

instance.Xsl = value
[RequiresDesignerPermissionAttribute]
[WebPartStorageAttribute(Storage.Shared)]
[ResourcesAttribute("", "Advanced", "Xsl")]
public XmlElement Xsl { get; set; }

Property value

Type: System.Xml.XmlElement
System.Xml.XmlElement用來轉換此 Web 組件的內容的 XSLT。

備註

Xsl屬性是讀取/寫入,而且會儲存以相同的值,為所有使用者 (Storage.Shared)。這個屬性的值會儲存在資料庫中。內嵌的 XSL 可以轉換到Xml ] 或 [ XmlLink ] 屬性指定的 XML 內容。您無法指定編碼中內嵌的 XSL,因為網頁組件傳遞到字串的 XSL。未處理的編碼值。此屬性和XslLink的相似處以內嵌的Xml和XmlLink屬性。網頁組件頁面先檢查XslLink是否有值。如果是的話,網頁組件會使用該連結的結果,並忽略Xsl屬性。如果沒有定義XslLink ,網頁組件使用的Xsl屬性內容,不過,如果XslLink是無法存取,或是傳回無效的 XSL,錯誤會出現在組件和Xsl屬性會被忽略。如果這兩個屬性定義,內容將不會轉換任何呈現。

Examples

下列程式碼範例示範如何設定此屬性。

//Create a new XML Web Part
XmlWebPart xmlWebPart = new XmlWebPart();

//Create an XmlElement to hold the value of the Xsl property
XmlDocument xmlDoc = new XmlDocument();
XmlElement xmlElement = xmlDoc.CreateElement("MyElement");
xmlElement.InnerText = "XSL goes here";

//Set the Xsl property to the XmlElement
xmlWebPart.Xsl = xmlElement;
'Create a new XML Web Part
Dim xmlWebPart As New XmlWebPart()

'Create an XmlElement to hold the value of the Xsl property
Dim xmlDoc As New XmlDocument()
Dim xmlElement As XmlElement = xmlDoc.CreateElement("MyElement")
xmlElement.InnerText = "XSL goes here"

'Set the Xsl property to the XmlElement
xmlWebPart.Xsl = xmlElement

請參閱

參照

XmlWebPart class

XmlWebPart members

Microsoft.SharePoint.WebPartPages namespace