[MarkLogic Dev General] External Functions

Colleen Whitney Colleen.Whitney at marklogic.com
Tue Nov 6 10:07:07 PST 2007


Hi Gary,
 
If I understand your question correctly, what you need to do is write a
library module, then import it in a main module.  In the main module,
you can call the function defined in the imported module just as you
would if it was defined locally.
  
(: common.xqy :) 
module "http://www.w3.org/2003/05/xpath-functions" 
define function uris() as xs:string* { 
  for $n in collection() 
  return xs:string(xdmp:node-uri($n)) 
} 
 
 
(: main.xqy :) 
import module 
 "http://www.w3.org/2003/05/xpath-functions" at "common.xqy" 
uris() 
 
 
See the developer's guide (section 12) for more detail.
 
--Colleen
 

________________________________

From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Gary Vidal
Sent: Tuesday, November 06, 2007 9:41 AM
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] External Functions



In XQuery Specifications they allow for functions that are defined as
external.  I have read through the documentation but do not see how to
call them in MarkLogic.  Ideally I would like to develop a interface
type of functionality to allow another module to define the
implementation of the module and allow that called module to use that
function.  But I don't see how this can be implemented.

 

Ex. 

 

Module "urn:my-hello-world"

 

define function hello-world($name as xs:string) as xs:string external

 

??How would you call this module???

 

 

Gary Vidal

Sr. .Net Developer

Tel: 212-592-4946

gvidal at alm.com

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20071106/82a58911/attachment-0001.html


More information about the General mailing list