Condition : where to use this...
If you use substring to show some of the words it will cut the word in between the letters.
For example:
The word "content" is often used coll....
Instead of that use this following template to cut the paragraph by space.So that words not cut between the letters.
For Example:
The word "content" is often used colloquially....
|
Template : Strip words by space
<!--strip words by space -->
<xsl:template name="FirstNWords">
<xsl:param name="TextData"/>
<xsl:param name="WordCount"/>
<xsl:param name="MoreText"/>
<xsl:choose>
<xsl:when test="$WordCount > 1 and (string-length(substring-before($TextData, ' ')) > 0 or string-length(substring-before($TextData, ' ')) > 0)">
<xsl:value-of select="concat(substring-before($TextData, ' '), ' ')" disable-output-escaping="yes"/>
<xsl:call-template name="FirstNWords">
<xsl:with-param name="TextData" select="substring-after($TextData, ' ')"/>
<xsl:with-param name="WordCount" select="$WordCount - 1"/>
<xsl:with-param name="MoreText" select="$MoreText"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="(string-length(substring-before($TextData, ' ')) > 0 or string-length(substring-before($TextData, ' ')) > 0)">
<xsl:value-of select="concat(substring-before($TextData, ' '), '...')" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$TextData" disable-output-escaping="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--Strip words by space -->
|
Call the template With your column
<xsl:call-template name="FirstNWords">
<xsl:with-param name="TextData" select="@ShortDescription"/>
<xsl:with-param name="WordCount" select="12"/>
</xsl:call-template>
|