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

Re: my nearest sibling

Subject: Re: my nearest sibling
From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx>
Date: Tue, 6 Jul 1999 18:04:48 +0200
Re: my nearest sibling
Sebastian Rahtz <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>Any volunteers to express "go up and get my nearest older sibling"?
>In this example:
>
> <list type="gloss"><label><gi>front</gi></label><item>contains any
> prefatory matter (headers, title page, prefaces, dedications, etc.)
> found before the start of a text proper.</item>
>
>when processing <item>, I want to get my paws on the associated
><label>.
>
>Is this really trivial and I am being dense? should
>
> "../label[position()]"

>work? actually, position() never seems to do what I expect. does it
>produce the sibling count?

No, it is the position in "the context node list" of the node matched by the
pattern, not of the node matched by the <xsl:template> containing the
pattern. You can work around this by using a variable:

<xsl:variable name="position-before-me" expr="position() - 1"/>
<xsl:??? select="../*[position() = $position-before-me]"/>

But it is better to:

<xsl:??? select="from-preceding-siblings(*[1])"/>

See section 6.1.1 (Axes).

Share & Enjoy,

    Oren Ben-Kiki


 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.