Hi Mindie,

 

XQuery 1.0 (and 1.0-ml) does not allow you to declare functions in the
fn namespace, which is the default namespace.  For main modules, the
local: namespace is available for this purpose.  So the function
declarations should look like:

 

declare function local:testFunction() .....

 

Alternately, you can put the function in its own namespace like this:

 

xquery version "1.0-ml";

 

declare namespace foo="foo";

 

declare function foo:testFunction() ....

 

Hope that helps,

-Danny

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mindie
Sorenson
Sent: Thursday, September 25, 2008 4:33 PM
To: [email protected]
Subject: [MarkLogic Dev General] trigger error

 

I have created a trigger that will execute when a document is modified
in a particular folder.  However, if I declare any function in the .xqy
code that is executed, I get the following error:  

 

Error:  XDMP-FUNNSRES: (err:XQST0045) Functions may not be declared in
reserved namespace

 

If I remove the function, the code works great.

 

I upgraded to 4.0-1 today.  My default xquery version is 1.0-ml

 

I had someone else that is still on version 4.0-20080722 run this code,
and it worked for them.  

 

Here is my code (note that the function does nothing, but still throws
an error - I wanted to get the function as basic as I could)

 

xquery version "1.0-ml";

 

declare function testFunction() {

let $foo := "null"

return $foo

};

 

let $foo := xdmp:email(

<em:Message xmlns:em="URN:ietf:params:email-xml:"
xmlns:rf="URN:ietf:params:rfc822:">

    <rf:subject>This is the subject</rf:subject>

    <rf:from>

        <em:Address>

            <em:name>LDS.org Admin</em:name>

            <em:adrs>[EMAIL PROTECTED]</em:adrs>

        </em:Address>

    </rf:from>

    <rf:to>

        <em:Address>

            <em:name>Admin</em:name>

            <em:adrs>[EMAIL PROTECTED]</em:adrs>

        </em:Address>

    </rf:to>

    <em:content>This is the body</em:content>

</em:Message>)

return ()

 

Does anyone have any ideas or suggestions?

 

Thanks

Mindie

 

 

 

________________________________

NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to