views:

565

answers:

2

Assuming there is some way to do this... I am using WSS 3.0 and SP Designer 2007. I've changed a list to its XSLT data view in SPD, and am trying to add a formula to display the first 250 characters of the body text, and then IF there are additional characters, add a "(more)" link to the list item.

The problem I'm running into is the conditional aspect... the following successfully adds the "(more)" text and links correctly. But I can't seem to figure out how to only execute it if the body text > 250 characters. Any ideas?

concat(substring(@Body,0,250),'... <a href="/Lists/Highlighted%20Items/DispForm.aspx?ID=',@ID,'">(more)</a>')

I can use string-length(@Body) to get the length... but how do I put these together?

Thanks, Mark

+4  A: 

Does this help?

<xsl:choose>
    <xsl:when test="string-length(@Body) &gt 250"></xsl:when>
    <xsl:otherwise></xsl:otherwise>
</xsl:choose>
Nat
Yes! Thank you.
Mark
A: 

Some time ago I wrote an article on my blog about creating short descriptions (basically the same case that you're mentioning but then for the Content Query Web Part). It might help you get some answers. The article is available @ http://blog.mastykarz.nl/generating-short-description-content-query-web-part/

Waldek Mastykarz - MOSS MVP