There are 2 types of modules in XQuery, library modules and main modules.

You can not invoke a library module directly, you will need to create a main 
module that imports that library module and invoke that main module.  You would 
need to put your library module either on the file system or in a modules 
database, and configure your application server "modules" and "root" settings 
accordingly.

Or you can do what David suggests and merely exclude the module declaration.  
But you'd also need/want to call the function that you're declaring.

> -----Original Message-----
> From: [email protected] [mailto:general-
> [email protected]] On Behalf Of Srinivas Mandadapu
> Sent: Wednesday, September 23, 2009 11:29 AM
> To: [email protected]
> Subject: [MarkLogic Dev General] newbie question
>
> Hi,
>    I am a newbie to Marklogic and trying out basic stuff on cq.However I
> am running into a problem which I am not able to comprehend at all. I
> have an article DB setup for which I loaded some sample documents and
> trying to run the below code in cq:
>
> xquery version "1.0-ml";
> module namespace local="http://marklogic.com/appservices/ArticleDB";;
>
> declare function local:sortArticles() as xs:string
> {
>
>     for $v in fn:doc()
>
>     order by $v/article/effectivedate
>
>     return
>      <test>
>     <art>{$v/article/articleNum}</art>
>     <dt>{$v/article/effectivedate}</dt>
>     </test>
>  };
>
>
> ERROR: Cannot evaluate library module:
> in /cq/eval.xqy line 111:
>
>
> But if the run the same with out the module and function declarations, I
> see the results.
>
> Can someone help me understand where I am going wrong. I really
> appreciate your help.
>
> Thanks,
> Srini
> _______________________________________________
> 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