Re: [xsl] Deepest element in the tree

Subject: Re: [xsl] Deepest element in the tree
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Aug 2016 20:00:00 -0000
On 24.08.2016 21:46, Rick Quatro rick@xxxxxxxxxxxxxx wrote:

I am trying to find the deepest, last element in an xml file. When I use
this xpath 1.0 statement:

//*[last()]

it returns all nine of the last elements.

You can select


(//*[not(*)])[last()]

to find the last leaf element not having any children (which in your sample would be the <p>4</p> element).

Does that suffice?

Or do you want to count the ancestor nodes and determine elements with most ancestors?

Current Thread