Hi,

I would like to count all nodes "source" of "word" that start with the string "ABC".

I can have multiple "word" inside a the element "wordGrp", as in

entry/section/following-sibling::wordGrp/word/following-sibling::source

For-each-group and a following count(current-group()) did not work for me, the XSLT processor returned

"A sequence of more than one item is not allowed as the first argument"

So what I currently have is

<xsl:for-each select="entry/section/following-sibling::wordGrp/word/following-sibling::source">

<xsl:if test="starts-with(., 'ABC/')">
<xsl:value-of select="."/>
</xsl:if>

</xsl:for-each>

And this prints a list of elements which comply to the condition. But I am unable to count how many.

Thank you very much for your help,

Larry

You could either use the count() function or recursion. What have you tried so far?

Thanks for your answer.

I've tried a count :

<xsl:value-of select="count(starts-with(entry/section/following-sibling::wordGrp/word/following-sibling::source, 'ABC'))"/>

But then I get the message

"A sequence of more than one item is not allowed as the first argument"

I must admit I'm not confortable with the recursion. Could you post me some pseudo-code ?

Thanks.

If you provide an example of your XML document, I would be glad to show you how to use recursion to obtain the desired output.