xsl-list
[Top] [All Lists]

[xsl] Deepest element in the tree

2016-08-24 14:46:11
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(_at_)frameexpert(_dot_)com



--~----------------------------------------------------------------
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>