xsl-list
[Top] [All Lists]

Basic string parsing/splitting question.

2004-06-10 13:57:28
Sorry for this basic question...

I have a comma delimited list of tokens in a string that I want to get the 
first three from (if there are more than three). Else just the first one or two.

I.e. Given this string:
"Dogs, Big Sheep, Little Mice, Ants, Pelicans"

I'd like the result to be:
"Dogs, Big Sheep, Little Mice ..." 

Given:
"Dogs, Big Sheep, Little Mice"
It should just say:
"Dogs, Big Sheep, Little Mice"

Ditto for shorter ones.

Seems like there should be a function to split after the third occurrence of 
",", but I don't find that anywhere.

Meanwhile, I'm looking at the EXSLT extensions to see if I can use a tokenizer 
or something like that.

Any help would be appreciated.

I'm using XalanJ 2.6.

Thanx,
Max


<Prev in Thread] Current Thread [Next in Thread>