For example, using the string: "This is a string longer than 35 characters." Limited to 35 characters, it would normally be: "This is a string longer than 35 cha..."
Can I have it 'snap' to the nearest word? So instead it would output: "This is a string longer than 35..."
I don't know if you have found a solution for your question.
But if you don´t have the Ucomponents package, can maybe do what you ask for.
In the Ucomponents package there is a extension method named strings, with this XSLT extension you should be able to break astringby nearest word, as I read the documentation.
I must say, that I don´t have used this XSLT extension myself, but I think it can helps you out here.
How to limit the output lenght?
Hello...
The following line, displays all my text in my blogposts.
<xsl:value-of select="$post/bodyText" disable-output-escaping="yes"/>
What i want is to display only, etc. 50 words, so that my frontpage look clean.
But how do i do that, whitout destroying th html?
<xsl:value-of select="umbraco.library:TruncateString($post/bodyText, number(50), '...')" disable-output-escaping="yes" />
but it's a number of characters.
Thanks !!! :)
Just what I was looking for. Thanks :)
What about to the nearest word?
For example, using the string:
"This is a string longer than 35 characters."
Limited to 35 characters, it would normally be:
"This is a string longer than 35 cha..."
Can I have it 'snap' to the nearest word? So instead it would output:
"This is a string longer than 35..."
Hi Jon,
I don't know if you have found a solution for your question.
But if you don´t have the Ucomponents package, can maybe do what you ask for.
In the Ucomponents package there is a extension method named strings, with this XSLT extension you should be able to break a string by
nearest word, as I read the documentation.
I must say, that I don´t have used this XSLT extension myself, but I think it can helps you out here.
The Ucomponents package: http://ucomponents.codeplex.com/releases/view/100480 and the documentation for the string
extension method: http://ucomponents.org/xslt-extensions/strings
I hope this can help you to solve your question.
/Dennis
Hi Jon,
Could you use my inputs to find a solution, for 'snap' to the nearest word?
/Dennis
is working on a reply...