|
Subject: Re: my nearest sibling From: "Oren Ben-Kiki" <oren@xxxxxxxxxxxxx> Date: Tue, 6 Jul 1999 18:04:48 +0200 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Using XSL to get output in repo, Steve Slatcher | Thread | my nearest sibling, Sebastian Rahtz |
| Re: Swapping table rows and columns, David Carlisle | Date | Re: my nearest sibling, G. Ken Holman |
| Month |