Part 3 of Step Patterns: Predicates

Predicates, the third part of step patterns, contain XPath expressions. You can use the [] operator to enclose a predicate and test whether a certain condition is true.

For example, you can test

  • The value of an attribute in a given string.

  • The value of an element.

  • Whether an element encloses a particular child, attribute, or other element.

  • The position of a node in the node tree.

You’ll work with XPath expressions in more detail in Chapter 7, but we’ll get an introduction to them here because you can use them in pattern predicates.

XPath expressions are more involved than match patterns. If you run into trouble creating them, one thing that’s good to know is that the Xalan package has a handy example program, ...

Get Inside XSLT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.