Appendix B. XSLT Pattern Grammar

Table B-1 lists the entire grammar for patterns in XSLT 1.0, straight from the XSLT 1.0 Recommendation at http://www.w3.org/TR/xslt. The syntax for patterns is a subset of the syntax for XPath expressions.

Table B-1. Patterns

[1]

Pattern

LocationPathPattern
| Pattern '|' LocationPathPattern

[2]

LocationPath-Pattern

'/' RelativePathPattern?
| IdKeyPattern (('/'|'//')
RelativePathPattern)?
| '//'? RelativePathPattern

[3]

IdKeyPattern

'id' '(' Literal ')'
| 'key' '(' Literal ',' Literal ')'

[4]

RelativePath-Pattern

StepPattern
| RelativePathPattern '/'
StepPattern
| RelativePathPattern '//'
StepPattern

[5]

StepPattern

ChildOrAttributeAxisSpecifier
NodeTest Predicate*

[6]

ChildOr-AttributeAxis-Specifier

AbbreviatedAxisSpecifier
| ('child' | 'attribute') '::'

The AbbreviatedAxisSpecifier, NodeTest, Predicate, and Literal productions are defined in the XPath grammar. See Appendix A.

Get XSLT 1.0 Pocket Reference 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.