How to truncate string with xsl

I was playing around with a stylesheet for a RSS feed, and wanted to truncate the description attribute to display only 100 chars,..
so after a couple try’s this is how I solved it,..

<xsl:value-of disable-output-escaping="yes" select="substring(description, 1, 100)" />

now i don’t remember all the string functions out there so I used this awesome page for XSL reference,..
http://nwalsh.com/docs/tutorials/xsl/xsl/slides.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: