Subject: RE: Infinite Recursion Looking for Whitespace. RESOLUTION
From: "HEATH ALLISON" <HEATH.ALLISON@xxxxxxxxxxxxxxx>
Date: Mon, 27 Jan 2003 15:02:07 -0600
|
thanks for the assistance. here's what the working code looks like...
this allows me to call a template from my XSL that splits the last node of a sectioned document into two separate rows of a table, the top row is wider than the bottom, allowing for an image in the last TD of the bottom row. I'm sure there's probably a more economical way to do this, but I thought I'd post the code I came up with, for posterity sake.
<xsl:template name="lastBlah">
<xsl:param name="leftStringLength"/>
<xsl:param name="leftStringValue"/>
<xsl:param name="topOrBot" />
<xsl:if test="substring($leftStringValue,number($leftStringLength),1) != ' ' and $leftStringLength >0 ">
<!-- recursive call -->
<xsl:call-template name="lastBlah">
<xsl:with-param name="leftStringLength" select="$leftStringLength - 1"/>
<xsl:with-param name="leftStringValue" select="substring($leftStringValue,'1',number($leftStringLength)-1)" />
<xsl:with-param name="topOrBot" select="$topOrBot"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="substring($leftStringValue,number($leftStringLength),'1') = ' ' and $leftStringLength >0 ">
<xsl:choose>
<xsl:when test="$topOrBot=0">
<xsl:value-of select="substring($leftStringValue,0,$leftStringLength)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(.,$leftStringLength)" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
heath deforrest allison
"Arrowed!"
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|