[Bug 28196] [F+O3.1] Do the function conversion rules apply to parameters in option maps?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28196

--- Comment #1 from Michael Kay <mike@saxonica.com> ---
To take an example of the problem, consider a call that attempts to delete all
invalid characters from JSON input by doing:

parse-json($in, map{'fallback':function($s){""}})

It turns out this doesn't work, because the function is the wrong type. It has
to be written

parse-json($in, map{'fallback':function($s as xs:string) as xs:string {""}})

The extra verbiage is all telling the system what it could easily work out for
itself...

A pragmatic solution might be to relax the required type, so instead of
requiring

function($s as xs:string) as xs:string

the required type becomes

function($s as xs:string) as item()*

and we then specify what happens dynamically if the returned value isn't a
single string. The first call above then becomes legal. There are precedents
for this, for example fn:remove() takes xs:integer rather than
xs:positiveInteger as the second argument, to allow the function to be called
more easily.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 12 March 2015 08:23:21 UTC