Re: Function annotations

Note that in XSLT, the nearest equivalent to XQuery's function annotations would be user-defined attributes on an xsl:function element. In this case it would definitely be the case that the annotations have distinct names and are unordered.

We need to maintain the principle that the data model is common between XSLT and XQuery.

Michael Kay
Saxonica


> On 12 Oct 2016, at 11:00, Michael Kay <mike@saxonica.com> wrote:
> 
> I've had input from a user who wants to get information about the annotations on a function. 
> 
> Annotations don't seem to be part of the data model for function and we don't have any accessor functions that reveal the values of annotations.
> 
> My first thought is that it's easy enough to meet this requirement with an extension function, and the obvious one would be something like
> 
> function-annotations($f as function()) as map{xs:QName, item()*}
> 
> But the same user points out that Saxon isn't allowing several annotations on a function with the same name, although the spec appears to permit this. If the data model allows several annotations with the same name then this complicates the API.
> 
> So, a question: is it by design or by accident that we don't have any rule prohibiting multiple annotations on a function with the same name?
> 
> If we do allow it, is the order significant? Would you expect the order in which annotations appear to be retained in such an API?
> 
> Michael Kay
> Saxonica
> 

Received on Wednesday, 12 October 2016 10:08:53 UTC