xsl-list
[Top] [All Lists]

Re: [xsl] Deepest element in the tree

2016-08-24 15:00:19
On 24.08.2016 21:46, Rick Quatro rick(_at_)rickquatro(_dot_)com 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?

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>