[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Deepest element in the tree

Subject: Re: Deepest element in the tree
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Aug 2016 20:00:00 -0000
Re:  Deepest element in the tree
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.