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

Re: Select Deepest Node only in Iteration

Subject: Re: Select Deepest Node only in Iteration
From: "J. Zhang" <j.zhang@xxxxxx>
Date: Fri, 13 Jul 2007 13:51:52 +0200
Re:  Select Deepest Node only in Iteration
I want to output the deepest node. What I get now is:

//article/body[1]/section[6]/normallist[6]/item[1]
//article/body[1]/section[6]/normallist[6]
//article/body[1]/section[6]
//article/body[1]
//article

I only want to first item. When I set position()=1, I always get the
last item in the list, the root. When I set count(ancestor::node())=5, I
do get the first item, but 5 is not always the deepest level, e.g.
sometimes it is only 2.


jz

Michael Kay wrote:
> Start with a change in mindset. position() does work. It just isn't the
> answer to your particular requirement.
> 
> Within a sorted for-each, position() returns the position of a node in the
> sorted sequence.
> 
> I don't know what the solution to your requirement is. You haven't told us
> what you want to output, only that it's different to what position()
> outputs.
> 
> Michael Kay
> http://www.saxonica.com/

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.