xdmp:get-invoked-path() as xs:string
Returns the path of the module that is being invoked. Note that this is
different from xdmp:get-request-path
when the module is
invoked because an invoke or eval does not create a new request.
xdmp:get-invoked-path() => "/example.xqy"
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.