xsl-list
[Top] [All Lists]

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

2008-04-01 15:56:45
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--