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 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.