From c2ce1cca887db4c362fde3afd67972dde3c0c076 Mon Sep 17 00:00:00 2001 From: Michael Kay Date: Thu, 19 Dec 2024 16:49:19 +0000 Subject: [PATCH] 1649-fix-result-of-function-annotations --- .../src/function-catalog.xml | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml index 97e6abfa6..aa5455f4c 100644 --- a/specifications/xpath-functions-40/src/function-catalog.xml +++ b/specifications/xpath-functions-40/src/function-catalog.xml @@ -20585,7 +20585,7 @@ return function-arity($initial) - + @@ -20599,25 +20599,23 @@ return function-arity($initial)

The fn:function-annotations function returns the annotations of - $function as a sequence of (key, value) pairs. + $function as a sequence of singleton maps, each associating + the name of a function annotation with the value of the annotation. Note that several annotations on a function can share the same name. The order of the annotations is retained.

-

The result is a sequence of maps, each being an instance of - record(key as xs:QName, value as xs:anyAtomicType*). +

The result is a sequence of singleton maps, each being an instance of + map(xs:QName, xs:anyAtomicType*). If a function (for example, a built-in function) has no annotations, the result of the function is an empty sequence.

-

For each annotation, a map is returned, with two entries. One - entry has the key "key" as an xs:string, with the associated - value being the name of the annotation as an xs:QName. - The other has the key "value" as an xs:string, with the - associated value being the value of the annotation as a sequence of atomic items. +

For each annotation, a map is returned, with a single entry. The + key of the map entry is the name of the annotation as an xs:QName. + The value of the entry is the the value of the annotation as a sequence of atomic items. If the annotation has no values, the associated value is an empty sequence.

-

The type of the result is the same as the type of the first argument - to the map:of-pairs function. This means that in the common case where the annotation names are all unique, - the result of the function can readily be converted into a map by calling - map:of-pairs.

+

In the common case where the annotation names are all unique, + the result of the function can readily be converted into single map by applying the function + map:merge.

@@ -20631,9 +20629,7 @@ return function-arity($initial) declare %private function local:inc($c) { $c + 1 }; function-annotations(local:inc#1) - { "key": QName("http://www.w3.org/2012/xquery", "private"), - "value": () -} + { QName("http://www.w3.org/2012/xquery", "private"), () }