Hi,

This is the result of function mapping (see section 3.11 of the 4.0 release 
notes, at http://developer.marklogic.com/pubs/4.0/books/relnotes.pdf).

It can be a little startling if you're not expecting it.  Function mapping 
allows you to pass a sequence into a function that accepts singletons, and have 
the function execute once for every item in the sequence.  What you're seeing 
is that since you passed in an empty sequence, it was never executed.

For more details on how this works, including how to disable it if necessary, 
see section 3.2 of the XQuery Reference Guide:
http://developer.marklogic.com/pubs/4.0/books/xquery.pdf

Cheers,

--Colleen

-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Geert Josten
Sent: Thu 11/6/2008 8:12 AM
To: MarkLogic General ML
Subject: [MarkLogic Dev General] Empty argument fails silently?
 
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