Truncating strings using XSL
Problem
I want to display a RSS feed from Connotea for papers I've tagged with "Formicidae". The titles of these papers can be long, e.g.:
This takes up too much space when displayed in a panel on the web page, so I want to truncate the titles in a sensible way.
Solution
aaronland.info has a nice solution that truncates to a fixed length, optionally at a word boundary. Our verbose title becomes:
Much nicer.
Currently playing in iTunes: Dani California by Red Hot Chili Peppers
I want to display a RSS feed from Connotea for papers I've tagged with "Formicidae". The titles of these papers can be long, e.g.:
Dracula ant phylogeny as inferred by nuclear 28S rDNA sequences and implications for ant systematics (Hymenoptera: Formicidae: Amblyoponinae)
This takes up too much space when displayed in a panel on the web page, so I want to truncate the titles in a sensible way.
Solution
aaronland.info has a nice solution that truncates to a fixed length, optionally at a word boundary. Our verbose title becomes:
Dracula ant phylogeny as inferred by nuclear 28S...
Much nicer.
(Via Google: xsl truncate string.)
Currently playing in iTunes: Dani California by Red Hot Chili Peppers
1 Comments:
Hello mate, great blog
By Hannahology, at 6:00 am
Post a Comment
<< Home