Closed michaelhkay closed 1 day ago
I propose that (a) in the data model, two annotations cannot have the same name, but (b) writing %a(v1) %a(v2)
is allowed and is deemed equivalent to writing %a(v1, v2)
- that is, it creates a single annotation.
Further observation: XQuery says "If the namespace URI of an annotation is not recognized by the implementation, then the annotation is ignored." I propose changing this so that the annotation has no effect other than to retain the value and make it visible via the fn:function-annotations
function.
I’m ashamed to have overlooked that: It’s indeed fairly common for annotations to have the same name, and it’s important to not throw the values together. The most prominent example may be RESTXQ with its query and form parameters:
I think we’ll need to change the function definition and return the annotation values as array(s).
The function
fn:function-annotations
returns a map from QNames to values, which rather assumes that a function cannot have two annotations with the same name. But there is nothing in either the data model or the XQuery language spec that imposes this restriction.