Loading TOC...

xdmp:path

xdmp:path(
   $node as node(),
   [$include-document as xs:boolean?]
) as xs:string

Summary

Returns a string whose value corresponds to the path of the node.

Parameters
$node The node whose path is returned.
$include-document If true, then the path is presented with a leading doc(..)/.., otherwise the path is presented as /...

Example

let $arg := <a><b><c>ccc</c></b>
                <b>bbb</b></a>
return xdmp:path($arg/b[1]/c)

  => "/a/b[1]/c"

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • here is a pure xquery solution using the ancestor-or-self axis   let $arg := <a><b><c>ccc</c></b>                 <b>bbb</b></a> let $selected := $arg/b[1]/c return    $selected/string-join(ancestor-or-self::*/name(.), '/')       not as accurate as xdmp:path() but can be useful in those XQuery 1.0 situations