functx:path-to-node
A path to an XML node (or sequence of nodes)
Description
The functx:path-to-node function returns a path to that node, starting with the root element. Specifically, it will concatenate all the names of its ancestors, using a forward slash as a separator.
Note that it is not necessarily a path that will return just that node. For example, if there are several author element children of authors, and you run the function on author, it will return the path authors/author which will return all of the authors, not just the one you ran the function on. See functx:path-to-node-with-pos for a function that returns a unique path to that element.
Parameters |
Description |
---|---|
nodes:node() |
the node sequence |
Examples
XPath |
Results |
---|---|
functx:path-to-node($in-xml//lName[. = ‘Doe’]) |
authors/author/lName |
functx:path-to-node($in-xml/*[1]) |
authors/author |