joe
joe

Reputation: 17478

How do I select the position of a following sibling

I need to select the position of a following sibling via XSL.

This is not working:

<xsl:variable name="nextAnswerListItemPos" select="following-sibling::*[local-name() = 'AnswerListItem'][position()]" />

Upvotes: 1

Views: 2852

Answers (1)

Azat Razetdinov
Azat Razetdinov

Reputation: 1028

<xsl:variable name="nextAnswerListItemPos" select="count(following-sibling::*[local-name() = 'AnswerListItem'][1]/preceding-sibling::*) + 1" />

Upvotes: 3

Related Questions