Subject: RE: [xsl] count element content length From: Jarno.Elovirta@xxxxxxxxx Date: Tue, 16 Apr 2002 10:49:53 +0300 |
Heppa, > You are right, but I am not at that level yet =) > But hey! If I do like Santtu suggested, the result is a bit > wrong since > it adds "..." also to elements that are shorter than 20 > characters. What to do? <xsl:template match="Subject"> <p> <xsl:value-of select="concat(substring(., 1, 20), substring('...', 1 div (string-length(.) > 20), 3))" /> </p> </xsl:template> It uses the Becker method for adding the '...' the string length is greater than 20. See the archives or e.g. Jeni's book for further explanation. Cheers, Santtu XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] check if content value be, Oleg Tkachenko | Thread | RE: [xsl] count element content len, Jarkko . Moilanen |
RE: [xsl] count element content len, Jarkko . Moilanen | Date | RE: [xsl] generic template - possib, Jarno . Elovirta |
Month |