Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1649 result of function annotations #1666

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20699,7 +20699,7 @@ return function-arity($initial)</eg></fos:expression>

<fos:function name="function-annotations" prefix="fn">
<fos:signatures>
<fos:proto name="function-annotations" return-type="record(key as xs:QName, value as xs:anyAtomicType*)*">
<fos:proto name="function-annotations" return-type="map(xs:QName, xs:anyAtomicType*)*">
<fos:arg name="function" type="fn(*)"/>
</fos:proto>
</fos:signatures>
Expand All @@ -20712,26 +20712,24 @@ return function-arity($initial)</eg></fos:expression>
<p>Returns the annotations of the function item.</p>
</fos:summary>
<fos:rules>
<p>The <function>fn:function-annotations</function> function returns the annotations of
<code>$function</code> as a sequence of (key, value) pairs.
<p>The <code>fn:function-annotations</code> function returns the annotations of
<code>$function</code> 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.</p>
<p>The result is a sequence of maps, each being an instance of
<code>record(key as xs:QName, value as xs:anyAtomicType*)</code>.
<p>The result is a sequence of singleton maps, each being an instance of
<code>map(xs:QName, xs:anyAtomicType*)</code>.
If a function (for example, a built-in function) has no annotations,
the result of the function is an empty sequence.</p>
<p>For each annotation, a map is returned, with two entries. One
entry has the key <code>"key"</code> as an <code>xs:string</code>, with the associated
value being the name of the annotation as an <code>xs:QName</code>.
The other has the key <code>"value"</code> as an <code>xs:string</code>, with the
associated value being the value of the annotation as a sequence of atomic items.
<p>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 <code>xs:QName</code>.
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.</p>
</fos:rules>
<fos:notes>
<p>The type of the result is the same as the type of the first argument
to the <function>map:of-pairs</function> 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
<function>map:of-pairs</function>.</p>
<p>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
<code>map:merge</code>.</p>
</fos:notes>
<fos:examples>
<fos:example>
Expand All @@ -20745,9 +20743,7 @@ return function-arity($initial)</eg></fos:expression>
<fos:expression><eg>
declare %private function local:inc($c) { $c + 1 };
function-annotations(local:inc#1)</eg></fos:expression>
<fos:result><eg>{ "key": QName("http://www.w3.org/2012/xquery", "private"),
"value": ()
}</eg></fos:result>
<fos:result><eg>{ QName("http://www.w3.org/2012/xquery", "private"), () }</eg></fos:result>
</fos:test>
</fos:example>
<fos:example>
Expand Down
Loading