A filter in XML Grid View can be applied to an element node and enables you to filter the descendants of that node. Wherever a filter can be applied, a grayed out filter icon is displayed. Once a filter has been defined, this icon is shown in color (see screenshot below). A filter is defined with an XQuery 3.1 expression. For example, in the screenshot below, a filter has been set on the Temperatures node to display only those Month elements that have a Min child element with a value that is greater than 10. (Note that in the screenshot the index number of the respective element instance is listed.)
To set up a filter, right-click the element you want to filter, select Filter from the context menu that appears, enter the XQuery expression, and click Enter. The Filter cell is indicated by the icon (see screenshot above). You can activate/deactivate the filter by clicking the Filter icon.
Note the following points about filters:
•Filters can be applied only to element nodes.
•The context node of the filter's XQuery expression is the current node. In the screenshot above, for example, the context node is the Temperatures node.
•Filters can be nested. A nested filter will be applied to the filtered content of the parent filter.
•To add a new line in an expression, press Ctrl+Enter. This is useful if you want to display an expression over several lines for better readability.
•The filtered content is a visual display only. The actual content remains unchanged.
•Each filter is executed independently and is not affected by other filters or formulas.
•Filters are not stored in the XML document, but can be kept in a special metadata file for subsequent use. If filters are stored, they will be automatically applied when the document is re-opened in Grid View. Go to Tools | Options | View | Grid View Settings to specify whether to automatically always store filters, store filters only on request, or not store filters.