Hi Geert,

You're running into the new function mapping capability (on by default
for 1.0-ml, off by default for 1.0). It's more obvious what it's doing
if you pass a longer list, in which case the function will be called for
each value and the return value will also be a list. If you were to do

        elem((<one/>, <two/>, <three/>))

you would get the list ("bla", "bla", "bla") returned.

If you do not wish to have this behavior, you can disable function
mapping by adding the following to your XQuery module's prolog.

        declare namespace xdmp="http://marklogic.com/xdmp";;
        declare option xdmp:mapping "false";

Wayne.


On Thu, 2008-11-06 at 17:12 +0100, Geert Josten wrote:
> Hi,
> 
> When passing an empty sequence where a node() is expected, the
> function does not execute, nor is a 'coercion' error is raised either.
> Is it supposed to work like this? With following example I would
> expect either the string 'blabla' or an error, but instead I am
> getting 'bla'.
> 
> ---------
> xquery version "1.0-ml";
> 
> declare default function namespace "my";
> 
> declare function elem($arg as node()) as xs:string {
>   "bla"
> };
> 
> elem(()), elem(<bla/>)
> ---------
> 
> I am running on MarkLogic Server 4.0-1..
> 
> Kind regards,
> Geert
> 
> 
> Drs. G.P.H. Josten
> Consultant
> 
> 
> http://www.daidalos.nl/
> Daidalos BV
> Source of Innovation
> Hoekeindsehof 1-4
> 2665 JZ Bleiswijk
> Tel.: +31 (0) 10 850 1200
> Fax: +31 (0) 10 850 1199
> http://www.daidalos.nl/
> KvK 27164984
> De informatie - verzonden in of met dit emailbericht - is afkomstig van 
> Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
> bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
> bericht kunnen geen rechten worden ontleend.
> 
> 
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to