[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Counting occurences of a character in a string


Subject: Re: [xsl] Counting occurences of a character in a string
From: "Christian Roth" <roth@xxxxxxxxxxxxxx>
Date: Wed, 2 Apr 2008 00:56:15 +0200

David Carlisle wrote:

>count(tokenize($s,'X'))-1

Ahh - and that is a use case for the zero-length elements (tokens)
generated when the separator pattern is matched directly at the start or
end of a string. I was wondering about that behaviour, and it was
actually my first pitfall in my initial attempt at a solution.

Thanks to all who responded so quickly! I'll make an xsl:function and
pick one of the implementations. Since that function will not be called
often, I guess I will not see a measurable (or better: relevant)
performance difference.

Christian


Current Thread