Understanding Patterns

A pattern is the syntax you’ll use to navigate around the source tree. As you’ve just seen, patterns are used in the match attribute of a template rule. As you’ll soon see, patterns can also be used to select nodes within the tree (such as an element or attribute) so that you can retrieve its content. Patterns are also used in XSLT to name and call template rules, iterate over a group elements of like structure, and a lot more.

Pattern syntax is a subset of a more verbose notation called location paths and is a part of a general class called XPath expressions. You’ll learn all about XPath expressions in Chapter 4. The good news is that basic pattern syntax is easy to learn and will allow you to perform 80% of what you’ll ...

Get Special Edition Using 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.