There are also some utility functions that return the path or the filename.

import module namespace util = "http://marklogic.com/xdmp/utilities"; at 
"/MarkLogic/utilities.xqy";

let $someurl := 
"/db/netvisn/global/analysis/result/98bbdd41-34b9-45d3-833e-4afe65fb9ec3.xml"

util:basename( $someurl )  

        returns "98bbdd41-34b9-45d3-833e-4afe65fb9ec3.xml"

util:basepath( $someurl ) 
        returns "/db/netvisn/global/analysis/result "

- Keith


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Gary Larsen
Sent: Friday, June 03, 2011 10:12 AM
To: 'General MarkLogic Developer Discussion'
Subject: Re: [MarkLogic Dev General] document name function

The regex solution worked great!

Thanks

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of G. Ken Holman
Sent: Friday, June 03, 2011 11:05 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] document name function

At 2011-06-03 11:05 -0400, Gary Larsen wrote:
>If there an xQuery function to return the document name?
>
>fn:document-uri(xdmp:directory('/db/netvisn/global/analysis/result/', 
>'infinity'))
>
>returns
>
>/db/netvisn/global/analysis/result/98bbdd41-34b9-45d3-833e-4afe65fb9ec3.xml
>
>But what I need  is
>
>98bbdd41-34b9-45d3-833e-4afe65fb9ec3.xml

replace( $fullname, '.*/([^/]+)$', '$1' )

I hope this helps.

. . . . . . . . Ken

--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
G. Ken Holman                 mailto:[email protected]
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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

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


 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://developer.marklogic.com/mailman/listinfo/general

Reply via email to