Search

hi,

Could anyone Please tell how to get only the text without applying styles at the time of using the "HTML Truncate Advanced" utility. I am using content editor for adding the content, but i need only the text without applying the styles which added using the editor.

Now i am getting the text with styles like bold, italic, horizontal line, etc.,

thanks

using the "HTML Truncate Advanced" utility

This utility is for when you specifically want to retain styling (HTML tags) in content. If you don't, try a much simpler truncate template such as:

<xsl:template name="truncate">
    <xsl:param name="text"/>
    <xsl:param name="length" select="'140'"/>

    <xsl:choose>
        <xsl:when test="string-length($text) &gt; $length">
            <xsl:value-of select="concat(normalize-space(substring($text, 1, $length)),'&#8230;')"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$text"/>
        </xsl:otherwise>
    </xsl:choose>

</xsl:template>

Use it like:

<xsl:call-template name="truncate">
    <xsl:with-param name="text" select="path/to/content/node"/>
    <xsl:with-param name="length" select="'300'"/>
</xsl:call-template>

hi,

my problem is need to display the whole last word. so i used the "HTML Truncate Advanced" utility with the help of my previous discussion (How to display the First N Words in symphony). but now also i am not getting the wold last word by using the new "truncate template" , could you please tell how to solve this..

thanks

Hi,

Thank u so much..

finally I got the output which i required exactly with the help of "truncate-string-by-words.xsl" which u mentioned above ..

thanks a lot. :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details