Subject: RE: [xsl] Infinite Recursion Looking for Whitespace. From: "Andy J. Cupp" <acupp@xxxxxxxxxxxxxxx> Date: Mon, 27 Jan 2003 11:51:01 -0600 |
Hi Allison. From your remarks, it seems you may have worked on this already, but I think you need an additional test to end the recursion. Currently, if the template never encounters a blank space, it will just keep looping, sending nothing as the $leftStringValue parameter and -1,-2,-3,... as the $leftStringLeft parameter. Maybe if you just have a test in the form of <xsl:if test="$leftStringValue">, that would end your recursion when the string has been examined. -----Original Message----- From: HEATH ALLISON [mailto:HEATH.ALLISON@xxxxxxxxxxxxxxx] Sent: Monday, January 27, 2003 10:57 AM To: XSL List Subject: [xsl] Infinite Recursion Looking for Whitespace. 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Infinite Recursion Looking fo, HEATH ALLISON | Thread | RE: [xsl] Infinite Recursion Lookin, HEATH ALLISON |
[xsl] Quality XSL Debugging Tools, Pilarski,James | Date | [xsl] implementation of xsl:strip-s, Wright, Steve |
Month |