Predicate filters

Location paths often select a number of elements. For example, consider the expression '/book/chapter/para'. When used in a Match pattern, all paragraphs in all chapters match the pattern. When used in a Select expression, all chapter paragraphs are selected. Often, especially in the latter scenario, the actual requirement is to locate a single element, or at least take into consideration factors beyond simple contextual location. A predicate filter can be added to 'filter out' unwanted nodes. Filters are expressions enclosed in square brackets, '[' and ']', which return a boolean value. When the value returned is 'true', the node is accepted; when the value returned is 'false', it is rejected. Only accepted nodes are retained ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.