[xsl] number of particular sub elements

Subject: [xsl] number of particular sub elements
From: "John Smith" <debrief@xxxxxxxxx>
Date: Sun, 9 Sep 2007 12:32:32 +0100

how can I retrieve the number of children in the context node and set
it as variable, or the parameter?

instead of this:

<xsl:template name="aName">
	<xsl:param name="max" select="last()" />

I want to do something like this, (the code below is incorrect and
only serves as a mean to describe what I am trying to achive)

<xsl:template name="aName">
	<xsl:param name="max" select="particularSubElements.last()" />

so if the context node was 'x' I want to the number of 'y' sub elements:

    <z />
    <y />
    <z />
    <y />
    <z />

So want to get the number of 'y' elements which in this case is 2.


Current Thread