6.6.6.2 Non-Terminals

[15]   

XPath

   ::=   

Expr?

[16]   

Expr

   ::=   

ExprSingle ("," ExprSingle)*

[17]   

ExprSingle

   ::=   

ForExpr
| QuantifiedExpr
| IfExpr
| OrExpr

[18]   

ForExpr

   ::=   

SimpleForClause "return" ExprSingle

[19]   

SimpleForClause

   ::=   

<"for" "$"> VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle)*

[20]   

QuantifiedExpr

   ::=   

(<"some" "$"> | <"every" "$">) VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle)* "satisfies" ExprSingle

[21]   

IfExpr

   ::=   

<"if" "("> Expr ")" "then" ExprSingle "else" ExprSingle

[22]   

OrExpr

   ::=   

AndExpr ( "or" AndExpr )*

[23]   

AndExpr

   ::=   

InstanceofExpr ( "and" InstanceofExpr )*

[24]   

InstanceofExpr

   ::=   

TreatExpr ( <"instance" "of"> SequenceType )?

[25]   

TreatExpr

   ::=   

CastableExpr ( <"treat" "as"> SequenceType )?

[26]   

CastableExpr

   ::=   

CastExpr ( <"castable" "as"> SingleType )?

[27]   

CastExpr

   ::=   

ComparisonExpr ( <"cast" "as"> SingleType )?

[28]   

ComparisonExpr

   ::=   

RangeExpr ( (ValueComp
| GeneralComp
| NodeComp) RangeExpr )?

[29]   

RangeExpr

   ::=   

AdditiveExpr ( "to" AdditiveExpr )?

[30]   

AdditiveExpr

   ::=   

MultiplicativeExpr ( ("+" | "-") MultiplicativeExpr )*

[31]   

MultiplicativeExpr

   ::=   

UnaryExpr ( ("*" | "div" | "idiv" | "mod") UnaryExpr )*

[32]   

UnaryExpr

   ::=   

("-" | "+")* UnionExpr

[33]   

UnionExpr

   ::=   

IntersectExceptExpr ( ("union" | "|") IntersectExceptExpr )*

/* Note that support for a UnionExpr of attributes in the last location step is optional*/

[34]   

IntersectExceptExpr

   ::=   

ValueExpr ( ("intersect" | "except") ValueExpr )*

[35]   

ValueExpr

   ::=   

PathExpr

[36]   

PathExpr

   ::=   

("/" RelativePathExpr?)
| ("//" RelativePathExpr)
| RelativePathExpr

[37]   

RelativePathExpr

   ::=   

StepExpr (("/" | "//") StepExpr)*

[38]   

StepExpr

   ::=   

AxisStep | FilterStep

[39]   

AxisStep

   ::=   

(ForwardStep | ReverseStep) Predicates

[40]   

FilterStep

   ::=   

PrimaryExpr Predicates

[41]   

ContextItemExpr

   ::=   

"."

[42]   

PrimaryExpr

   ::=   

Literal | VarRef | ParenthesizedExpr | ContextItemExpr | FunctionCall

[43]   

VarRef

   ::=   

"$" VarName

[44]   

Predicates

   ::=   

("[" Expr "]")*

[45]   

GeneralComp

   ::=   

"=" | "!=" | "<" | "<=" |
">" | ">="

[46]   

ValueComp

   ::=   

"eq" | "ne" | "lt" | "le" | "gt" | "ge"

[47]   

NodeComp

   ::=   

"is" | "<<" | ">>"

[48]   

ForwardStep

   ::=   

(ForwardAxis NodeTest) | AbbrevForwardStep

[49]   

ReverseStep

   ::=   

(ReverseAxis NodeTest) | AbbrevReverseStep

[50]   

AbbrevForwardStep

   ::=   

"@"? NodeTest

[51]   

AbbrevReverseStep

   ::=   

".."

[52]   

ForwardAxis

   ::=   

<"child" "::">
| <"descendant" "::">
| <"attribute" "::">
| <"self" "::">
| <"descendant-or-self" "::">
| <"following-sibling" "::">
| <"following" "::">
| <"namespace" "::">

[53]   

ReverseAxis

   ::=   

<"parent" "::">
| <"ancestor" "::">
| <"preceding-sibling" "::">
| <"preceding" "::">
| <"ancestor-or-self" "::">

[54]   

NodeTest

   ::=   

KindTest | NameTest

[55]   

NameTest

   ::=   

QName | Wildcard

[56]   

Wildcard

   ::=   

"*"
| <NCName ":" "*">
| <"*" ":" NCName>

[57]   

Literal

   ::=   

NumericLiteral | StringLiteral

[58]   

NumericLiteral

   ::=   

IntegerLiteral | DecimalLiteral | DoubleLiteral

[59]   

ParenthesizedExpr

   ::=   

"(" Expr? ")"

[60]   

FunctionCall

   ::=   

<QName "("> (ExprSingle ("," ExprSingle)*)? ")"

[61]   

SingleType

   ::=   

AtomicType "?"?

[62]   

SequenceType

   ::=   

(ItemType OccurrenceIndicator?)
| <"empty" "(" ")">

[63]   

AtomicType

   ::=   

QName

[64]   

ItemType

   ::=   

AtomicType | KindTest | <"item" "(" ")">

[65]   

KindTest

   ::=   

DocumentTest
| ElementTest
| AttributeTest
| PITest
| CommentTest
| TextTest
| AnyKindTest

[66]   

ElementTest

   ::=   

<"element" "("> ((SchemaContextPath ElementName)
| (ElementNameOrWildcard ("," TypeNameOrWildcard "nillable"?)?))? ")"

[67]   

AttributeTest

   ::=   

<"attribute" "("> ((SchemaContextPath AttributeName)
| (AttribNameOrWildcard ("," TypeNameOrWildcard)?))? ")"

[68]   

ElementName

   ::=   

QName

[69]   

AttributeName

   ::=   

QName

[70]   

TypeName

   ::=   

QName

[71]   

ElementNameOrWildcard

   ::=   

ElementName | "*"

[72]   

AttribNameOrWildcard

   ::=   

AttributeName | "*"

[73]   

TypeNameOrWildcard

   ::=   

TypeName | "*"

[74]   

PITest

   ::=   

<"processing-instruction" "("> (NCName | StringLiteral)? ")"

[75]   

DocumentTest

   ::=   

<"document-node" "("> ElementTest? ")"

[76]   

CommentTest

   ::=   

<"comment" "("> ")"

[77]   

TextTest

   ::=   

<"text" "("> ")"

[78]   

AnyKindTest

   ::=   

<"node" "("> ")"

[79]   

SchemaContextPath

   ::=   

<SchemaGlobalContext "/"> <SchemaContextStep "/">*

[80]   

OccurrenceIndicator

   ::=   

"?" | "*" | "+"