qt4cg / qtspecs

QT4 specifications
https://qt4cg.org/
Other
28 stars 15 forks source link

Function annotations in XSLT #714

Open michaelhkay opened 1 year ago

michaelhkay commented 1 year ago

I propose that the following attributes on an xsl:function should be accessible as annotations, for example in a call on function-annotations:

plus any extension attribute in a user-defined namespace, for example <xsl:function saxon:debug="yes"/> should have the annotation %saxon:debug("yes"). The value is always a single string, the actual attribute value as written.

Arithmeticus commented 1 year ago

What about also @use-when, to identify functions that potentially overshadow each other?

michaelhkay commented 1 year ago

Eh? If @use-when is false, the code to create the function is never even read. If a function makes it into the world, then @use-when was true by definition.

But perhaps you mean something different, like functions being excluded because of import precedence? Again, the function will have been discarded - you can't ask questions about functions that aren't visible because we throw them away as soon as we realise.

dnovatchev commented 1 year ago

I propose that the following attributes on an xsl:function should be accessible as annotations, for example in a call on function-annotations:

Compare this to being able to modify the behavior of any function in any wanted way, that has never before been planned for, and therefore never specified and documented in any specification document or via any extension attribute.

Of course, I am talking about decorators.

If we have decorators in XPath then there will be no need for annotations and no user will ever have to wait until Saxonica or any other implementor produces a desired new feature via an extension attribute.

Instead, the user will spend just a few minutes to create the desired decorator and then decorate the functions of interest with it.

This is a win-win situation for everybody: