Appendix A. XPath 1.0 Grammar
This appendix contains the entire grammar for the syntax of XPath 1.0. Refer to this section to remove any doubt about what is a syntactically valid expression.
Productions from XPath 1.0
Table A-1 through Table A-12 list the entire grammar of XPath 1.0, extracted from the XPath 1.0 Recommendation at http://www.w3.org/TR/xpath.
Table A-1. Location paths
|
|
RelativeLocationPath | AbsoluteLocationPath |
|
|
'/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath |
|
|
Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath |
Table A-2. Location steps
|
|
AxisSpecifier NodeTest Predicate* | AbbreviatedStep |
|
|
AxisName '::' | AbbreviatedAxisSpecifier |
Table A-3. Axes
|
| 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self' |
Table A-4. Node tests
|
|
NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' |
Table A-5. Predicates
|
|
'[' PredicateExpr ']' |
|
|
Expr |
Table A-6. Abbreviations
|
|
'//' RelativeLocation-Path |
|
|
RelativeLocation-Path '//' Step |
|
|
'.' | '..' |
|
|
'@'? |
Table A-7. Expressions
|
|
OrExpr |
|
|
VariableReference | '(' Expr ')' | Literal | Number | FunctionCall ... |
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.