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

RE: Calling position() on a parent element

Subject: RE: Calling position() on a parent element
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 8 May 2002 17:02:48 +0100
position parent
Try count(../preceding-sibling::*)

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 
> Graham Ashton
> Sent: 08 May 2002 15:33
> To: xsl-list
> Subject:  Calling position() on a parent element
> 
> 
> Hi.
> 
> I'm trying to convert this simple markup (which looks like HTML, but
> isn't):
> 
>   <tr>
>     <td>
>       <label>Hello World!</label>
>     </td>
>     <td>
>       <label>Foo</label>
>     </td>
>   </tr>
> 
> into something akin to this:
> 
>   <label>
>     <text>Hello World!</text>
>     <left_attach>0</left_attach>
>   </label>
>   <label>
>     <text>Foo</text>
>     <left_attach>1</left_attach>
>   </label>
> 
> The <left_attach> elements in the output tell the label or the button
> which table cell they should appear in. I'm having real 
> trouble getting
> hold of the values for <left_attach> from my source input, as I can't
> determine the position of the <td> element that a <label> belongs to,
> from the context of a <label>'s template.
> 
> This is close to what I'd like to be able to do:
> 
> <xsl:template match="td/label">
>   <label>
>     <text><xsl:value-of select="."/></text>
>     <left_attach><xsl:value-of 
> select="position(parent)"/></left_attach>
>   </label>
> </xsl:template>
> 
> Obviously, the "position(parent)" part is wrong (it just illustrates
> what I'd like to do).
> 
> Is there a way for the template that handles <label> elements to
> determine the position of <td> elements, within the <tr>?
> 
> I'm using the latest libxslt. Thanks.
> 
> -- 
> Graham Ashton
> 
> 
>  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.