Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Geoff Stokes 19 posts 38 karma points
    Aug 19, 2011 @ 10:26
    Geoff Stokes
    0

    Limit string to X characters, but only split after a word

    Hi,

    I have a parameter on a page which is a rich text area, and I would like to display a shortened version of this on another page, however, I would like to limit it to, say, 100 characters, but rather than splitting at exactly 100 characters, I want to split at the last space before 100 characters.

    Is this easily possible from within an XSLT macro? Presently I am inserting the entire paragraph like this:

    <xsl:value-of select="current()/eventDescription" disable-output-escaping="yes"/>

     

  • Rich Green 2246 posts 4008 karma points
    Aug 19, 2011 @ 10:48
    Rich Green
    1

    Hi,

    You can use the uComponents 'GetFirstWords' method to get the first x number of words from a string. 

    http://ucomponents.codeplex.com/wikipage?title=Strings&referringTitle=Documentation

    Rich

Please Sign in or register to post replies

Write your reply to:

Draft