This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Counting proceding elements with the attribute value
- From: Joerg dot Heinicke at gmx dot de
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 8 Apr 2002 01:01:21 +0200 (MEST)
- Subject: Re: [xsl] Counting proceding elements with the attribute value
- References: <00eb01c1de77$92161600$1e3cecc2@niklas>
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Then I have this XSLT fragment:
> <xsl:template match="node">
> <xsl:value-of select="@name" />
> <xsl:if test="following-sibling::attr/@name = @name or
> preceding-sibling::attr/@name = @name">
> <!-- here I want to output the number of proceding elements with the
> same
> value in the name attribute -->
> </xsl:if>
> </xsl:template>
I think the best is
<xsl:value-of select="count(../node[@name = current()/@name])"/>
Joerg
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list