[xsl] Infinite Recursion Looking for Whitespace.

Subject: [xsl] Infinite Recursion Looking for Whitespace.
From: "HEATH ALLISON" <HEATH.ALLISON@xxxxxxxxxxxxxxx>
Date: Mon, 27 Jan 2003 10:56:53 -0600
Hello again, I'm still trying to fix my line-break problem. I'm trying to get my recursion loop to rifle through the value of $leftStringValue from the end to the start, but stop when it encounters the first blank space. The xsl:if test works if I set it to the value of $stringLength with a test of "> 0". But the second I change it to look for a space at the last position in a substring of $stringValue it goes infinite and overflows the stack. Any suggestions?

<xsl:template name="loop">
	<xsl:param name="leftStringLength"/>
	<xsl:param name="leftStringValue"/>
		
		<xsl:if test="(normalize-space(substring($leftStringValue,number($leftStringLength),'1'))) != ' ' ">

		String Length: <xsl:value-of select="$leftStringLength" /> <BR/>
		String Value: <xsl:value-of select="$leftStringValue" /> <BR/>
		String End: <xsl:value-of select="substring($leftStringValue,number($leftStringLength),'1')" /><BR/>
		
		<!-- recursive call -->
			<xsl:call-template name="loop">
				<xsl:with-param name="leftStringLength" select="$leftStringLength - 1"/>
				<xsl:with-param name="leftStringValue" select="substring($leftStringValue,'1',number($leftStringLength)-'1')" />
			</xsl:call-template> 
		</xsl:if>
	
</xsl:template>


heath deforrest allison
"Arrowed!"




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread