>From what it looks like, all of your code in in "0.9-ml" xquery, but the 
>version declaration is missing from your trigger modules. I'd guess that the 
>default xquery version isn't set to "0.9-ml" try adding that to the module and 
>see if it clears things up.

-fs


-----Original Message-----
From: [email protected] on behalf of Santhosh Raj
Sent: Mon 3/30/2009 7:57 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Problem in accessing $trgr:uri variable inthe 
trigger module - reg., 
 
Hi all,

        I have created a trigger as specified in the Developers guide., It 
is giving error in the trigger module while trying to access the $trgr:uri 
external variable.

Trigger:

(: Create - Trigger :)
xquery version "0.9-ml"
import module namespace trgr="http://marklogic.com/xdmp/triggers";
at "/MarkLogic/triggers.xqy"
try{
trgr:create-trigger("exampleTrigger0", "Simple exampleTrigger example1",
trgr:trigger-data-event(
trgr:directory-scope("/myDir/", "1"),
trgr:document-content("create"),
trgr:post-commit()),
trgr:trigger-module(xdmp:database("training"), "/modules/", "log.xqy"),
fn:true(), xdmp:default-permissions() )

}
catch($e) {
  "error in creating trigger" , $e
}

Trigger Module:

xdmp:document-insert("/modules/log.xqy",
text{ "
import module namespace trgr='http://marklogic.com/xdmp/triggers'
at '/MarkLogic/triggers.xqy'
define variable $trgr:uri as xs:string external
xdmp:log(fn:concat('*****Document ', $trgr:uri, ' was created.*****'))"
} )

Document Creation:

(: Document create event which will invoke the trigger :)
xquery version "0.9-ml"
xdmp:document-insert("/myDir/test3.xml", <test/>)


Error Message:

XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected 
DefineVariableDollar_, expecting SemiColon_
query evaluated in training at file:xdbcRoot/

Stack trace:
in /log.xqy line 4: 

With out that variable, then the trigger is working fine.   If i use the 
following code as the trigger module without the $trgr:uri variable the it 
is working fine.
xdmp:document-insert("/modules/log.xqy",
                        text{ " xdmp:log(('*****A new Document  was 
created.*****'))" } )

What should i do to access the $trgr:uri variable in the trigger module.

Thanks in advance.

Santhosh Rajasekaran
Tata Consultancy Services
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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

Reply via email to