This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: count element content length
- From: Jarno dot Elovirta at nokia dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 16 Apr 2002 09:18:36 +0300
- Subject: RE: [xsl] count element content length
- Reply-to: xsl-list at lists dot mulberrytech dot com
Heppa,
> Is there some method to count the elements content length and when
> for example the 20th character is met, then it would stop showing
> the rest and put ... after that. Because of my lowsy english, here
> is one example:
>
> elements content:
> <Subject id="0000000002">Chattaamaan city chattiin ke klo 12</Subject>
>
> the result should be:
> <p>Chattaamaan city cha...</p>
<xsl:template match="Subject">
<p>
<xsl:value-of select="concat(substring(., 1, 20),'...')" />
</p>
</xsl:template>
But you might want to consider breaking the string at word boundary
Cheers,
Santtu
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list