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

Re: XPath expression for finding out the depth of a gi

Subject: Re: XPath expression for finding out the depth of a given node?
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Sun, 17 Nov 2002 12:10:13 -0800
xpath depth
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 17 November 2002 10:10, Andreas Schildbach wrote:
> Is there a XPath expression for finding out the depth of a given node (or
> just the context node) in the document?

Well, XPath has a count() function, and it also has the ancestor:: axis, and 
the '*' pattern to match any element.  Put it all together, and you get 
count(ancestor::*).  That should pretty much do it.  If you want a 1- based 
count instead of a 0- count, use count(ancestor-or-self::*).

- -- 
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE91/elhDAgUT1yirARAlNFAJ4y3yfmm4CR0kc+jz2SEXiZEVMK3ACdGOA4
GHm1DmcVfeBBq2X76Y/ocTQ=
=U9Pq
-----END PGP SIGNATURE-----


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.