I have written the following code which checks whether the string provided is greater than 1- characters in which case only print the first 10 characters, otherwise print complete string. But I am getting error "Unable to display this web part" probably due to some bug in my syntax. Please check.
<xsl:template name="ShortenDetail">
<xsl:param name="String">
<xsl:choose>
<xsl:when test="string-length($String) > '10'">
<xsl:value-of select="substring($String, 0,9)"></xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$String"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
</xsl:template>
EDIT
And please also tell me how to use this function within a function in xslt. Following is the code which I am already using in my XSLT. This function cleans the "Detail" column that I am receiving from list and then after that I want to apply ShortenDetail function (mentioned above) but I don't know how to do that.
<xsl:call-template name="RemoveHtml">
<xsl:with-param name="String" select="@Detail"/>
</xsl:call-template>
I tried using like this but getting error:
<xsl:call-template name="ShortenDetail">
<xsl:call-template name="RemoveHtml">
<xsl:with-param name="String" select="@Detail"/>
</xsl:call-template>
</xsl:call-template>