You need to combine the substring and string-length functions:
Code:
<xsl:template name="strip-end-characters">
<xsl:param name="text"/>
<xsl:param name="strip-count"/>
<xsl:value-of select="substring($text, 1, string-length($text) - $strip-count)"/>
</xsl:template>
Full example:
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="title">
<xsl:call-template name="strip-end-characters">
<xsl:with-param name="text" select="."/>
<xsl:with-param name="strip-count" select="3"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="strip-end-characters">
<xsl:param name="text"/>
<xsl:param name="strip-count"/>
<xsl:value-of select="substring($text, 1, string-length($text) - $strip-count)"/>
</xsl:template>
</xsl:stylesheet>
If using XSLT 2.0 you'd probably rewrite this as an xsl:function.
(Change the match="title" to match any text containing element and run against your XML.)
--
Joe (
Microsoft MVP - XML)