I need a XSLT function which will return me the xpath to the node from which it called.
One reason that there's no standard function is that people want the path for different reasons:
Sometimes a/b/c/d
is enough.
Some people want a[3]/b[5]/c[1]/d[2]
.
Some people want a path where the names don't contain namespace prefixes, so it has to be something like
*:a[namespace-uri()='abc']/*:b[namespace-uri='xyz']
etc.