Extending element and attribute tests to NameTest unions

In the XPath and XQuery drafts the element and attribute tests have been
extended to support any NameTest, meaning they now support all wildcard
forms, which is great.

It is possible to write a path expression that takes a union of different
paths -- such as `html//(ol|ul)` -- however it is not possible to define a
precise type that accepts that path expression in variables, parameters, or
return types, so if a user does specify a type some type information is
lost during the static analysis phase.

As such, I propose renaming CatchErrorList to NameTestUnion and making
ElementTest and AttributeTest accept a NameTestUnion:

[86] CatchClause ::= "catch" NameTestUnion EnclosedExpr
[87] NameTestUnion ::= NameTest ("|" NameTest)*
[212] AttributeTest ::= "attribute" "(" (NameTestUnion ("," TypeName)?)? ")"
[215] ElementTest ::= "element" "(" (NameTestUnion ("," TypeName "?"?)?)?
")"

Kind regards,
Reece

Received on Saturday, 12 December 2020 10:46:47 UTC