This solution was created by a guy named Marc, the XSL templates he created are just, well, freaking fantastic! View his blog entry here: Displaying the First N Words of a Long Rich Text Column with XSL
I have been looking for a solution to cleanly limit the output of a SharePoint list field. Most of the time I find solutions that I piece together to make my desired outcome. However, with FirstNWords and the StripHTML templates that Marc shared, there was nothing left to be desired.
For my implementation of his solution: at the beginning of my row template I added the xsl:variable tag, effectively stripping the HTML from the @SRDetails field and placing into $BodyText. Then where I wanted to display the output, I added the xsl:call-template tag for FirstNWords with the appropriate xsl:with-param values. The actual template code was placed directly below the row template, with the only changes being:
1. StripHTML: replace the < sign in the xsl:when to < .
2. StripHTML: replace the other two signs (< and >) as Marc stated.
3. FirstNWords: replace the > signs in the first and second xsl:when to > .
Awesome solution…thanks Marc.
-Aaron Gilbert