When your module (log.xqy) is run as a trigger, it is passed the URI of the document it was triggered for as an external variable. Add this declaration to log.xqy:
import module namespace trgr = "http://marklogic.com/xdmp/triggers" at "/MarkLogic/triggers.xqy"; declare variable $trgr:uri as xs:string external; And then you can refer to it in your code. Your module is also passed the trigger definition as an external variable: declare variable $trgr:trigger as node() external; On Aug 31, 2010, at 7:34 AM, Mahitha T U wrote: > Hi All, > > In the following code snippet, In log,xqy file ,i want to identify which > particular document in the collection has invoked the trigger. > kindly help in this regard. > > import module namespace trgr="http://marklogic.com/xdmp/triggers" at > "/MarkLogic/triggers.xqy"; > trgr:create-trigger("myTrigger", "Simple trigger example", > trgr:trigger-data-event(trgr:collection-scope("testcoll"), > trgr:document-content("modify"), > trgr:pre-commit()), > trgr:trigger-module(xdmp:database("testdb"), "/test/", "log.xqy"), > fn:true(), xdmp:default-permissions() ) > > Regards, > Mahitha > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general --- Ron Hitchens {mailto:[email protected]} Ronsoft Technologies +44 7879 358 212 (voice) http://www.ronsoft.com +1 707 924 3878 (fax) Bit Twiddling At Its Finest "No amount of belief establishes any fact." -Unknown _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
