|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








