[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: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Aug 2016 20:17:23 -0000
Re:  Deepest element in the tree
Aren't you just saying you want the last element in document order, which is

(//*)[last()]

Michael Kay
Saxonica


> On 24 Aug 2016, at 21:01, Rick Quatro rick@xxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> As I look at this, I don't think my subject line is quite accurate. I
> actually need the deepest element on the last branch. See even if the
> <p>3</p> element had a lot of ancestors, I would still want the <p>4</p>
> element.
>
> -----Original Message-----
> From: Rick Quatro rick@xxxxxxxxxxxxxx
> [mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx]
> Sent: Wednesday, August 24, 2016 3:47 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Deepest element in the tree
>
> Hi,
>
> 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. I want to get the <p>4</p>
element
> because it is the last of the last. Note that I don't know ahead of time
> what element name it will be. I tried this
>
> //*[last()][last()]
>
> but it still returns all of them. Any help would be appreciated. Here is my
> xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <topic>
>    <body>
>        <p>
>            <ul>
>                <li>
>                    <p>1</p>
>                </li>
>                <li>
>                    <p>2</p>
>                </li>
>                <li>
>                    <p>3</p>
>                </li>
>                <li>
>                    <p>4</p>
>                </li>
>            </ul>
>        </p>
>    </body>
> </topic>
>
> Rick Quatro
> Carmen Publishing Inc.
> 585-366-4017
> rick@xxxxxxxxxxxxxxx

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.