[xsl] Calling position() on a parent element

Subject: [xsl] Calling position() on a parent element
From: Graham Ashton <gashton@xxxxxxxxxxx>
Date: 08 May 2002 15:33:16 +0100

I'm trying to convert this simple markup (which looks like HTML, but

      <label>Hello World!</label>

into something akin to this:

    <text>Hello World!</text>

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">
    <text><xsl:value-of select="."/></text>
    <left_attach><xsl:value-of select="position(parent)"/></left_attach>

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

Current Thread