Reputation: 1000
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:
Unfortunately, both functions work on existing nodes only.
Upvotes: 0
Views: 867
Reputation: 163262
If /some/dummy/element
returns 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.
Upvotes: 1