My mission is to output a text block in html and truncate the text at around a specific amount of characters. But the text can hold some extra inline tags like anchor tags. Not tables. I only want to count the rendered text not the markup. When I want to truncate the text and put an ellipsis after the text I don't want the tag to be truncated so that I end up with invalid html. Has anybody had this mission before and can help me solving this problem.
For example truncate a text at say around 20 characters. And the xml is "I want to be <a href='#'>truncated</a> here.
The output must be "I want to be <a href='#'>truncat</a>..." in the browser you see : I want to be
truncat... . I don't ask for a total code but just a hint how my strategy should look like ( total code is always appreciated :-)