0

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

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by fpmurphy
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.