XPath 3.1 Grammar

XPath::=Expr
AbbrevForwardStep::="@" NodeTest
AbbrevReverseStep::=".."
AnyArrayTest::="array" "(" "*" ")"
AnyFunctionTest::="function" "(" "*" ")"
AnyKindTest::="node" "(" ")"
AnyMapTest::="map" "(" "*" ")"
Argument::=(ExprSingle | ArgumentPlaceholder)
ArgumentList::="(" (Argument ("," Argument)) ")"
ArgumentPlaceholder::="?"
ArrayConstructor::=(SquareArrayConstructor | CurlyArrayConstructor)
ArrayTest::=(AnyArrayTest | TypedArrayTest)
ArrowFunctionSpecifier::=(EQName | VarRef | ParenthesizedExpr)
AtomicOrUnionType::=_QName_or_EQName
AttribNameOrWildcard::=(AttributeName | "*")
AttributeDeclaration::=AttributeName
AttributeName::=_QName_or_EQName
AttributeTest::="attribute" "(" (AttribNameOrWildcard ("," TypeName)) ")"
AxisStep::=(ReverseStep | ForwardStep) PredicateList
BaseChar::=[AAZZ aazz ÀÀÖÖ ØØöö øøÿÿ ĀĀıı ĴĴľľ ŁŁňň ŊŊžž ƀƀǃǃ ǍǍǰǰ ǴǴǵǵ ǺǺȗȗ ɐɐʨʨ ʻʻˁˁ ΆΆ ΈΈΊΊ ΌΌ ΎΎΡΡ ΣΣώώ ϐϐϖϖ ϚϚ ϜϜ ϞϞ ϠϠ ϢϢϳϳ ЁЁЌЌ ЎЎяя ёёќќ ўўҁҁ ҐҐӄӄ ӇӇӈӈ ӋӋӌӌ ӐӐӫӫ ӮӮӵӵ ӸӸӹӹ ԱԱՖՖ ՙՙ աաֆֆ אאתת װװײײ ءءغغ ففيي ٱٱڷڷ ںںھھ ۀۀێێ ېېۓۓ ەە ۥۥۦۦ अह ऽ क़ॡ অঌ এঐ ওন পর ল শহ ড়ঢ় য়ৡ ৰৱ ਅਊ ਏਐ ਓਨ ਪਰ ਲਲ਼ ਵਸ਼ ਸਹ ਖ਼ੜ ਫ਼ ੲੴ અઋ ઍ એઑ ઓન પર લળ વહ ઽ ૠ ଅଌ ଏଐ ଓନ ପର ଲଳ ଶହ ଽ ଡ଼ଢ଼ ୟୡ அஊ எஐ ஒக ஙச ஜ ஞட ணத நப மவ ஷஹ అఌ ఎఐ ఒన పళ వహ ౠౡ ಅಌ ಎಐ ಒನ ಪಳ ವಹ ೞ ೠೡ അഌ എഐ ഒന പഹ ൠൡ กฮ ะ าำ เๅ ກຂ ຄ ງຈ ຊ ຍ ດທ ນຟ ມຣ ລ ວ ສຫ ອຮ ະ າຳ ຽ ເໄ ཀཇ ཉཀྵ ႠჅ აჶ ᄀ ᄂᄃ ᄅᄇ ᄉ ᄋᄌ ᄎᄒ ᄼ ᄾ ᅀ ᅌ ᅎ ᅐ ᅔᅕ ᅙ ᅟᅡ ᅣ ᅥ ᅧ ᅩ ᅭᅮ ᅲᅳ ᅵ ᆞ ᆨ ᆫ ᆮᆯ ᆷᆸ ᆺ ᆼᇂ ᇫ ᇰ ᇹ Ḁẛ Ạỹ ἀἕ ἘἝ ἠὅ ὈὍ ὐὗ Ὑ Ὓ Ὕ Ὗώ ᾀᾴ ᾶᾼ ι ῂῄ ῆῌ ῐΐ ῖΊ ῠῬ ῲῴ ῶῼ Ω KÅ ℮ ↀↂ ぁゔ ァヺ ㄅㄬ 가힣 ]
BracedURILiteral::="Q" "{" ([{}]) "}"
Char::=[	 
 
   � ]
CombiningChar::=[̀ͅ ͠͡ ҃҆ ֑֡ ֹ֣ ֻֽ ֿ ׁׂ ׄ ًْ ٰ ۖۜ ۝۟ ۠ۤ ۧۨ ۪ۭ ँः ़ ाौ ् ॑॔ ॢॣ ঁঃ ় া ি ীৄ েৈ ো্ ৗ ৢৣ ਂ ਼ ਾ ਿ ੀੂ ੇੈ ੋ੍ ੰੱ ઁઃ ઼ ાૅ ેૉ ો્ ଁଃ ଼ ାୃ େୈ ୋ୍ ୖୗ ஂஃ ாூ ெை ொ் ௗ ఁః ాౄ ెై ొ్ ౕౖ ಂಃ ಾೄ ೆೈ ೊ್ ೕೖ ംഃ ാൃ െൈ ൊ് ൗ ั ิฺ ็๎ ັ ິູ ົຼ ່ໍ ༘༙ ༵ ༷ ༹ ༾ ༿ ྄ཱ ྆ྋ ྐྕ ྗ ྙྭ ྱྷ ྐྵ ⃐⃜ ⃡ 〪〯 ゙ ゚ ]
Comment::=CommentStart (CommentContents | Comment) CommentEnd
CommentContent::=Char
CommentContents::=CommentContent
CommentEnd::=":)"
CommentStart::="(:"
CommentTest::="comment" "(" ")"
ContextItemExpr::="."
CurlyArrayConstructor::="array" EnclosedExpr
DecimalLiteral::=(("." Digits) | (Digits "." [09]))
Digit::=[0099 ٠٠٩٩ ۰۰۹۹ ०९ ০৯ ੦੯ ૦૯ ୦୯ ௧௯ ౦౯ ೦೯ ൦൯ ๐๙ ໐໙ ༠༩ ]
Digits::=[09]
DocumentTest::="document-node" "(" (ElementTest | SchemaElementTest) ")"
DoubleLiteral::=(("." Digits) | (Digits ("." [09]))) [eE] [+-] Digits
ElementDeclaration::=ElementName
ElementName::=_QName_or_EQName
ElementNameOrWildcard::=(ElementName | "*")
ElementTest::="element" "(" (ElementNameOrWildcard ("," TypeName "?")) ")"
EnclosedExpr::=Lbrace Expr Rbrace
EQName::=(QName | URIQualifiedName)
EscapeApos::="''"
EscapeQuot::=""""
Expr::=ExprSingle ("," ExprSingle)
ExprSingle::=(ForExpr | LetExpr | QuantifiedExpr | IfExpr | OrExpr)
Extender::=[·· ːː ˑˑ ·· ــ ๆ ໆ 々 〱〵 ゝゞ ーヾ ]
ForExpr::=SimpleForClause "return" ExprSingle
ForwardAxis::=(("child" "::") | ("descendant" "::") | ("attribute" "::") | ("self" "::") | ("descendant-or-self" "::") | ("following-sibling" "::") | ("following" "::") | ("namespace" "::"))
ForwardStep::=((ForwardAxis NodeTest) | AbbrevForwardStep)
FunctionBody::=EnclosedExpr
FunctionCall::=_Function_QName_or_EQName (ArgumentList)
FunctionEQName::=(FunctionQName | URIQualifiedName)
FunctionItemExpr::=(NamedFunctionRef | InlineFunctionExpr)
FunctionQName::=(QNameToken | "ancestor" | "ancestor-or-self" | "and" | "as" | "cast" | "castable" | "child" | "descendant" | "descendant-or-self" | "div" | "else" | "eq" | "every" | "except" | "following" | "following-sibling" | "for" | "ge" | "gt" | "idiv" | "in" | "instance" | "intersect" | "is" | "le" | "let" | "lt" | "mod" | "namespace" | "ne" | "of" | "or" | "parent" | "preceding" | "preceding-sibling" | "return" | "satisfies" | "self" | "some" | "then" | "to" | "treat" | "union")
FunctionTest::=(AnyFunctionTest | TypedFunctionTest)
GeneralComp::=("=" | "!=" | LeftAngleBracket | "<=" | ">" | ">=")
Ideographic::=[&#x4e00;&#x9fa5; &#x3007; &#x3021;&#x3029; ]
IfExpr::="if" "(" Expr ")" "then" ExprSingle "else" ExprSingle
ImplicitlyAllowedWhitespace::=WhitespaceChar
InlineFunctionExpr::="function" "(" ParamList ")" ("as" SequenceType) FunctionBody
IntegerLiteral::=Digits
ItemType::=(KindTest | ("item" "(" ")") | FunctionTest | MapTest | ArrayTest | AtomicOrUnionType | ParenthesizedItemType)
KeySpecifier::=(NCName | IntegerLiteral | ParenthesizedExpr | "*")
KindTest::=(DocumentTest | ElementTest | AttributeTest | SchemaElementTest | SchemaAttributeTest | PITest | CommentTest | TextTest | NamespaceNodeTest | AnyKindTest)
Lbrace::="{"
LeftAngleBracket::="<"
LetExpr::=SimpleLetClause "return" ExprSingle
Letter::=(BaseChar | Ideographic)
Literal::=(NumericLiteral | StringLiteral)
LocalPart::=NCNameTok
Lookup::="?" KeySpecifier
MapConstructor::="map" Lbrace (MapConstructorEntry ("," MapConstructorEntry)) Rbrace
MapConstructorEntry::=MapKeyExpr ":" MapValueExpr
MapKeyExpr::=ExprSingle
MapTest::=(AnyMapTest | TypedMapTest)
MapValueExpr::=ExprSingle
Minus::="-"
NamedFunctionRef::=_Function_QName_or_EQName "#" IntegerLiteral
NamespaceNodeTest::="namespace-node" "(" ")"
NameTest::=(_QName_or_EQName | Wildcard)
NCName::=QName
NCNameColonStar::=NCNameTok ":*"
NCNameTok::=Nmstart Nmchar
Nmchar::=(Letter | CombiningChar | Extender | Digit | "." | "-" | "_")
Nmstart::=(Letter | "_")
NodeComp::=("is" | "<<" | ">>")
NodeTest::=(KindTest | NameTest)
NumericLiteral::=(IntegerLiteral | DecimalLiteral | DoubleLiteral)
NumericLiteralError::=(("." Digits) | (Digits ("." [09]))) ([eE] [+-] Digits) [azAZ]
OccurrenceIndicator::=("?" | "*" | Plus)
Param::="$" _QName_or_EQName TypeDeclaration
ParamList::=Param ("," Param)
ParenthesizedExpr::="(" Expr ")"
ParenthesizedItemType::="(" ItemType ")"
PathExpr::=((Slash RelativePathExpr) | (SlashSlash RelativePathExpr) | RelativePathExpr)
PITest::="processing-instruction" "(" (NCName | StringLiteral) ")"
Plus::="+"
PostfixExpr::=PrimaryExpr (Predicate | ArgumentList | Lookup)
Predicate::="[" Expr "]"
PredicateList::=Predicate
PrimaryExpr::=(Literal | VarRef | ParenthesizedExpr | ContextItemExpr | FunctionCall | FunctionItemExpr | MapConstructor | ArrayConstructor | UnaryLookup)
QName::=(FunctionQName | "array" | "attribute" | "comment" | "document-node" | "element" | "empty-sequence" | "function" | "if" | "item" | "map" | "namespace-node" | "node" | "processing-instruction" | "schema-attribute" | "schema-element" | "switch" | "text" | "typeswitch")
QNameToken::=(NCNameTok ":") LocalPart
QuantifiedExpr::=("some" | "every") "$" VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle) "satisfies" ExprSingle
Rbrace::="}"
RelativePathExpr::=StepExpr ((Slash | SlashSlash) StepExpr)
ReverseAxis::=(("parent" "::") | ("ancestor" "::") | ("preceding-sibling" "::") | ("preceding" "::") | ("ancestor-or-self" "::"))
ReverseStep::=((ReverseAxis NodeTest) | AbbrevReverseStep)
SchemaAttributeTest::="schema-attribute" "(" AttributeDeclaration ")"
SchemaElementTest::="schema-element" "(" ElementDeclaration ")"
SequenceType::=(("empty-sequence" "(" ")") | (ItemType OccurrenceIndicator))
SimpleForBinding::="$" VarName "in" ExprSingle
SimpleForClause::="for" SimpleForBinding ("," SimpleForBinding)
SimpleLetBinding::="$" VarName ":=" ExprSingle
SimpleLetClause::="let" SimpleLetBinding ("," SimpleLetBinding)
SimpleMapExpr::=PathExpr ("!" PathExpr)
SimpleTypeName::=TypeName
SingleType::=SimpleTypeName "?"
Slash::="/"
SlashSlash::="//"
SquareArrayConstructor::="[" (ExprSingle ("," ExprSingle)) "]"
StarColonNCName::="*:" NCNameTok
StepExpr::=(PostfixExpr | AxisStep)
StringLiteral::=((""" (EscapeQuot | ["]) """) | ("'" (EscapeApos | [']) "'"))
TextTest::="text" "(" ")"
TypedArrayTest::="array" "(" SequenceType ")"
TypeDeclaration::="as" SequenceType
TypedFunctionTest::="function" "(" (SequenceType ("," SequenceType)) ")" "as" SequenceType
TypedMapTest::="map" "(" AtomicOrUnionType "," SequenceType ")"
TypeName::=_QName_or_EQName
UnaryLookup::="?" KeySpecifier
URIQualifiedName::=BracedURILiteral NCNameTok
URIQualifiedStar::=BracedURILiteral "*"
ValueComp::=("eq" | "ne" | "lt" | "le" | "gt" | "ge")
VarName::=_QName_or_EQName
VarRef::="$" VarName
WhitespaceChar::=[&#x0009; &#x000D; &#x000A; &#x0020; ]
Wildcard::=("*" | NCNameColonStar | StarColonNCName | URIQualifiedStar)