共用方式為


XMLDefinition and CAML View Schema

Applies to: SharePoint Foundation 2010

The XmlDefinition property of the XsltListViewWebPart contains the View element that describes the view’s query—the list of fields and their order, the sort, filter, and group options, and also some declarative view style settings.

The XmlDefinition property implements the same schema as the ListViewXml property of the ListViewWebPart class. However, unlike the ListViewWebPart class, the XsltListViewWebPart class ignores any top-level elements in the view that are used only for HTML rendering. Instead of using the elements of the View schema for rendering, SharePoint Foundation defines rendering through the cached XSLT templates in the XsltListViewWebPart class.

The following list shows the valid child elements of the View element and indicates whether they are recognized and parsed by the XsltListViewWebPart for the view settings that they contain, or ignored and replaced with XSLT rendering:

Most of the "recognized" elements define the query that returns a row set by using the SPDataSource object. The resulting XML data is then transformed to XHTML by XSLT. For information about the dsQueryResponse XML that is used to transform the XML data, see Overview of XSLT List View Rendering System. Elements that are contained in the XmlDefinition property (for example, the ViewStyle element) provide declarative hints about rendering to be performed by XSLT, but they do not explicitly define rendering patterns or templates. Editing an XsltListViewWebPart through the SharePoint Foundation user interface only modifies the "recognized" elements in the XmlDefinition property of the Web Part.

XmlDefinition also exists as a global parameter, and you can use this parameter to retrieve view settings for use in XSLT. For example, <xsl:value-of select = "$XmlDefinition/RowLimit"/> retrieves the row limit that is specified by the RowLimit element.

See Also

Concepts

XsltListViewWebPart and Custom List Views

Overview of XSLT List View Rendering System

XSLT Parameter Bindings

XSLT Global Parameters

How to: Implement Resources in Custom List Views