Part 1 of Step Patterns: Pattern Axes

Axes make up the first part of step patterns. For example, in the step pattern child::NAME, which refers to a <NAME> element that is a child of the context node, child is called the axis. Patterns support two axes (XPath, on the other hand, supports no less than 13 different axes—see Chapter 7):

  • The attribute axis holds the attributes of the context node.

  • The child axis holds the children of the context node. The child axis is the default axis if one is not explicitly set.

You can use axes to specify a location step or path as in the following example, where I use the child axis to indicate that I want to match the child nodes of the context node, which is a <PLANET> element:

 <xsl:template match="PLANET"> ...

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.