home contribute faq download

FunctX XSLT Functions


A path to an XML node (or sequence of nodes)



The functx:path-to-node function returns a path to that node, starting with the root element. Specifically, it will concatenate all the names of its ancestors, using a forward slash as a separator.

Note that it is not necessarily a path that will return just that node. For example, if there are several author element children of authors, and you run the function on author, it will return the path authors/author which will return all of the authors, not just the one you ran the function on. See functx:path-to-node-with-pos for a function that returns a unique path to that element.

Arguments and Return Type

$nodes node()* the node sequence
return value xs:string*

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:path-to-node" as="xs:string*"
  <xsl:param name="nodes" as="node()*"/>

  <xsl:sequence select="
$nodes/string-join(ancestor-or-self::*/name(.), '/')



<xsl:variable name="in-xml" as="item()*">
XSLT ExampleResults
<functx:path-to-node($in-xml//lName[. = 'Doe'>)

See Also

functx:path-to-node-with-posA unique path to an XML node (or sequence of nodes)
functx:distinct-element-pathsThe distinct paths of all descendant elements in an XML fragment


Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XSLT Services

Recommended Reading: