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

RE: Get Position of Node in Ancestor Context

Subject: RE: Get Position of Node in Ancestor Context
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 10 Mar 2003 20:07:03 -0000
get position of div
You are following the well-trodden mistake of thinking "I want the
position of something, therefore I need the position() function".

The position() function gives you the position of a node in the list of
nodes you are currenly processing.

If you want the position of a node relative to related nodes in the same
tree, there are two ways of doing it: xsl:number, and count(). For
example, count(preceding::*). In this example, xsl:number is a better
bet. 

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Ted Stresen-Reuter
> Sent: 10 March 2003 15:21
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Get Position of Node in Ancestor Context
> 
> 
> Hi,
> 
> I'm trying to get the position of the current node in the 
> context of an 
> ancestor.
> 
> For example, I have a form element that has a number of children 
> elements, including non-form elements (such as P and DIV 
> elements). I'm 
> trying to retrieve the position of an INPUT element relative to the 
> parent FORM element, but not taking into account any non-form 
> elements 
> (such as P and DIV elements).
> 
> Currently I have a template that matches "input | select | textarea" 
> but because they occur in the context of a TD element, position() 
> returns "1". I've tried using <xsl:value-of 
> select="ancestor::form/*/*[position()]" />, but this just isn't doing 
> the trick.
> 
> Any suggestions how I can get the position of the current element 
> relative to a parent form element?
> 
> Ted Stresen-Reuter
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.