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

Absolute-path/index challenge

Subject: Absolute-path/index challenge
From: Thomas E Enebo <Thomas.E.Enebo-2@xxxxxxxxxx>
Date: Thu, 20 Jan 2000 12:58:13 -0600 (CST)
tom enebo
As an extension of the position() of parent question from digest 480,
I have a challenge.  How can a template be created, such that it will 
print out the complete path of current node from the root?  As an
example:

<A>
  <B>
    <C/>
  </B>
  <B>
    <C/>
    <C/> <--- calling a template with current() here...
  </B>
  <B>
  </B>
</A>

will yield

A:1.B:2.C:2

Where the first part is the element name and the second part is it's
relative position with respect to all other nodes at the same level.

I know I would need to create a named template that recurses passing
the parent to next invocation of template.  I also know the end case
is when the current node is the root.    

To print the index I think I would use David Carlisles comment on
position
thread yesterday..

  <xsl:value-of select="1+count(../preceding-sibling::*)"/>

Anyone?

-Tom

-- 
+--------http://www.tc.umn.edu/~enebo --------+-mailto:enebo@xxxxxxxxxx -+
| Thomas E Enebo, Friend of the University    | ???????????????????????? |
| Phone: (612) 237-4607  Fax: (???) ???-????  | ???????????????????????? |


 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.