saxon:path

Returns an XPath expression that identifies a node

path() ➔ xs:string

There are no arguments

Result

xs:string

path($node as node()) ➔ xs:string

Arguments

 

$node

node()

The node whose path is required

Result

xs:string

Details

Namespace: http://saxon.sf.net/

The first 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.

Notes on the Saxon implementation

This function is obsolescent; applications should use the XPath 3.0 fn:path() function in preference.