# saxon:path()

saxon:path($n as node()) ==> xs:string

saxon:path() ==> xs:string

The second version of the function (with no arguments) is equivalent to supplying "." as the argument. In this case there must be a context item and it must be a node.

The function returns a string whose value is an XPath expression identifying the selected node in the source tree. This can be useful for diagnostics, or to create an XPointer value, or when generating another stylesheet to process the same document. The resulting string can be used as input to the `evaluate()` function, provided that any namespace prefixes it uses are declared.

The generated path will use lexical QNames as written in the original source document. In documents that use multiple namespaces, this may not be the most suitable representation if there is a requirement to evaluate the XPath expression later, as any prefixes it uses will need to be declared.

Next