If you look at the use case I referred to, you will see that it includes a user-written function.
 
Or were you thinking of calling functions written in an external language, such as Java? For that, see the "extensibility" page in the documentation.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of waraporn_mee@lycos.co.uk
Sent: 11 August 2004 16:14
To: saxon-help@lists.sourceforge.net
Subject: RE: [saxon] invoking functions in XQuery

Thank Michael for reply. I have tried to follow some use cases, it works.

What if I would like to invoke my own customised-functions in queries? how can add-in and call them from Saxon? For instance, I implement *synonym* function, the expected query could be such as

for $item1 in  doc("file:///c:/sample1.xml")//A/B,
    $item2 in doc("file:///c:/sample2.xml")//C
where
    synonym($item1/data) = synonym($item2/data)

return
    <out>
        {$item1/data}
        {$item2/data}
    </out>


This sample is only a rough idea. it might get syntax error. otherwise, is it possible to do so? anyone have got some thoughts?




W.Jirapanthong


> From:: "Michael Kay" <mhk@mhk.me.uk>
> To: <saxon-help@lists.sourceforge.net>
> Subject:: RE: [saxon] invoking functions in XQuery
> Date: 08/11/2004

There are many examples of function calls in the use-cases, which are distributed in the "use-cases" directory. These include calls on both system-defined and user-defined functions. See for example use-cases/tree/q1.xq.
 
If you are having problems calling functions, show us your code and we can tell you where you have gone wrong.
 
Michael Kay
Saxonica Limited
http://www.saxonica.com/

Was this advice useful? If you benefit from the help given, especially on a commercial project, you can help us to continue to provide this service by making a donation. See http://sourceforge.net/project/project_donations.php?group_id=29872 


Heart disease is Britains biggest killer. Join the British Heart Foundations Big Red Fightback: bhf.org.uk/fightback