Subject:Limit description characters in XSLT transformation. Author:john ww Date:06 Oct 2006 08:25 PM
Hi,
I really cant find this anywhere on the internet so I've come here and i hope someone can help. I can transform an XML so that only the most recent 3 (or any number) items display with a link in the title and a description underneath. At the moment the descriptions are short enough to be fully included.
What i would like to do now is to limit the size of the description displayed and have it end in ... . It can either be a certain number of characters or words.
e.g
Title with link
First # amounts of characters before...
I have used the itemsperpage variable but cant for the life of me think how to do the description. Its done in dreamweaver also.
Subject:Limit description characters in XSLT transformation. Author:Tony Lavinio Date:07 Oct 2006 01:38 AM
Can you just change
<xsl:value-of select="description" disable-output-escaping="yes" />
to
<xsl:value-of select="concat(substring(description, 1, 100), '...')"/>
Do you really need 'disable-output-escaping'? The problem is if you
are truncating the content, and the stuff inside is HTML, you might
split a tag.