Re: [xsl] Absolute position

Subject: Re: [xsl] Absolute position
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 15 Mar 2001 17:04:32 +0000
Carmelo,

If I understand your question correctly, for each element as the context node, your magic number is

count(preceding::node()|ancestor::node())

or, if you want text nodes (and especially pesky whitespace-only text nodes) to be excluded,

count(preceding::*|ancestor::*)

You may have to make an allowance also for the root node (depending on whether you want it counted or not).

Regards,
Wendell

At 09:23 AM 3/15/01, you wrote:
Hi all:

    Does anyone knows how to get the aboslute value of an element
within a tree? and by that I  mean the order on which it is listed
within that tree.  Look at the tree below

  <child1>
  </child1>
  <child2> ...

To be more clear I am looking for this type of information

"child1" - is number 1
"child2" - is number 2
"child2-1" - is number 3
... and so on ....

in other words its "absolute position" as you read from to to bottom and
I want to know that information when THAT node is the context node
in other words if  "child6" is the current node I want to know that
it is really number 6 as I read. Any ideas?

====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread