From 39a5d93935bd61335e2c23dd2e933531e4f6d2eb Mon Sep 17 00:00:00 2001 From: Michael Kay Date: Thu, 28 Sep 2023 12:22:20 +0100 Subject: [PATCH] Allow record(*) --- specifications/grammar-40/xpath-grammar.xml | 14 ++++++++++++++ specifications/xquery-40/src/expressions.xml | 18 +++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/specifications/grammar-40/xpath-grammar.xml b/specifications/grammar-40/xpath-grammar.xml index 758499f04..6e24b5ec1 100644 --- a/specifications/grammar-40/xpath-grammar.xml +++ b/specifications/grammar-40/xpath-grammar.xml @@ -2862,6 +2862,20 @@ ErrorVal ::= "$" VarName + + + + + + + + record + ( + * + ) + + + record ( diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml index e0395973e..e047be1c0 100644 --- a/specifications/xquery-40/src/expressions.xml +++ b/specifications/xquery-40/src/expressions.xml @@ -5247,6 +5247,8 @@ name.

+ + @@ -5269,6 +5271,11 @@ name.

matches a map if it has an entry with key "e" whose value matches element(Employee), regardless what other entries the map might contain.

+

For generality, the syntax record(*) define an extensible record type that has no explicit + field declarations. The item type denoted by record(*) is equivalent to the item type + map(*): that is, it allows any map. +

+

A record test can constrain only those entries whose keys are strings, but when the record test is marked as extensible, then other entries may be present in the map with non-string keys. Entries whose key is a string can be expressed using an (unquoted) NCName if the key conforms to @@ -6352,15 +6359,20 @@ declare function flatten($tree as tree) as item()* { Record Tests

Given item types A and B, A B is true if any of the following apply:

+ +

A is map(*) and B is record(*).

+

All of the following are true:

-

A is a record test

-

B is map(*)

+

A is a record test.

+

B is map(*) or record(*).

- Example: + Examples:

record(longitude, latitude)map(*)

+

record(longitude, latitude, *)record(*)

+

record(*)map(*)