You can't increment values, and XSLT doesn't have the concept of an array as such.
What about simply doing "count(line[string(.)='ABC'])".
You could use the distinct-values(line/text()) to get a list of unique values of line values.
Code:
<?xml version='1.0' encoding='utf-8' ?>
<lines>
<line>ABC</line>
<line>BC</line>
<line>ABC</line>
<line>NBC</line>
<line>ABC</line>
<line>BC</line>
</lines>
<xsl:template match="/">
<xsl:variable name="root" select="."/>
<xsl:for-each select="distinct-values(//line/text())">
<xsl:sequence select="."/> = <xsl:sequence select="count($root//line[string(.)=current()])"/>
</xsl:for-each>
</xsl:template>
Produces: ABC = 3 BC = 2 NBC = 1
/- Sam Judson : Wrox Technical Editor -/