I have a function that accepts a node as an argument. I would like to get the string representation of the path whether it exists or not.
declare function mylib:getString($node) as xs:string {
return /*the string representation of the node's path*/
};
And sample invocation:
mylib:getString($xmlMessage/some/dummy/element);
Above example should return /some/dummy/element string. I have already tried two solutions:
- Function path() (e.g. /some/node/path()).
- Function path-to-node(…) within FunctX library but with no success.
Unfortunately, both functions work on existing nodes only.
If
/some/dummy/elementreturns nothing, there is no way of finding out which particular nothing it returned. If the path expression selects nothing, the result is an empty sequence, and you can’t apply a function to an empty sequence to determine where the empty sequence came from.