<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" ><xsl:output method="xml" indent="yes"/>

<xsl:template name="TrimL">
	
	<!--This template will recursively trim the trailing spaces from a string-->
   	<xsl:param name="strInput" select="''"/>
	<xsl:variable name="strLen" select="string-length($strInput)" />
	<xsl:variable name="strOutput" select="substring($strInput, 2, $strLen - 1 )" />
	<xsl:variable name="strFirstChar" select="substring($strInput, 1, 1 )" />

	<xsl:choose> 
	 <xsl:when test="$strFirstChar = ' '">	

	
		<!-- At this point, the template will recursively call itself until it is trimmed -->
		<xsl:call-template name="TrimL" > 
			<xsl:with-param name="strInput" select="$strOutput"/>
		</xsl:call-template>


	</xsl:when>
	 <xsl:otherwise>
			<xsl:value-of select="$strInput" />
	</xsl:otherwise>
	</xsl:choose>


</xsl:template>

</xsl:stylesheet>
