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

Namespace

http://saxon.sf.net/

Saxon availability

Requires Saxon-PE or Saxon-EE. From Saxon 11, no longer available.

Notes on the Saxon implementation

Available since before Saxon 8.0. This function is dropped in Saxon 11; applications should use the XPath 3.0 fn:path() function in preference.

Details

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.

See also:

fn:path()