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

RE: How to find out the level of an element

Subject: RE: How to find out the level of an element
From: "Arun Sinha" <arunsinha666@xxxxxxxxxxx>
Date: Thu, 08 Dec 2005 09:57:16 +0000
find out element
Please ignore the syntex of for-each.
it should be "select" instead of "test".

Type error.

Best Regards.

Arun



From: "Arun Sinha" <arunsinha666@xxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  How to find out the level of an element
Date: Thu, 08 Dec 2005 09:54:55 +0000

Hi,

Is it possible to find out fat what level a particular element is appearing from the root level?

For example:-

<a>
   <b>
      <c>
      </c>
   </b>
</a>

<a>
   <b>
      <c>
      </c>
   </b>
</a>

I tried the following code but it isn't working.

<xsl:variable name="LastLevel">
   <xsl:for-each test="//c[1]">
         <xsl:value-of select="count(ancestor::a | ancestor::b)" />
   </xsl:for-each>
</xsl:variable>

I need to find out the level of element <c>. In the above example it should be 2.

Thanks in advance.

Arun

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.