Renate,
At 03:20 PM 7/10/2006, you wrote:
I need to call one function for the same variable twice (somethin like
recursive)...
How to do this?
<xsl:variable name="CustomerSignerLName">
<xsl:call-template name="change">
<xsl:with-param name="name_string" select="LNAME"/>
<xsl:with-param name="delimiter" select="'-'"/>
</xsl:call-template>
</xsl:variable>
And once again with the same parameter:
<xsl:call-template name="change">
<xsl:with-param name="name_string"
select="$CustomerSignerLName"/>
<xsl:with-param name="delimiter" select="'-'"/>
</xsl:call-template>
And twice with another parameter:
<xsl:call-template name="change">
<xsl:with-param name="name_string"
select="$CustomerSignerLName"/>
<xsl:with-param name="delimiter" select="' '"/>
</xsl:call-template>
<xsl:call-template name="change">
<xsl:with-param name="name_string"
select="$CustomerSignerLName"/>
<xsl:with-param name="delimiter" select="' '"/>
</xsl:call-template>
How to write it correctly?
I don't see any obvious syntax errors here, but it's also not clear
from your description what you are trying to accomplish.
Oh, I think I get it. Try this:
<xsl:template name="change-string">
<xsl:param name="so-far" select="''"/>
<xsl:param name="delimiter-string" select="'-- '"/>
<xsl:choose>
<xsl:when test="$delimiter-string">
<xsl:call-template name="change-string">
<xsl:with-param name="so-far">
<xsl:call-template name="change">
<xsl:with-param name="name_string" select="$so-far"/>
<xsl:with-param name="delimiter"
select="substring($delimiter-string,1,1)"/>
</xsl:call-template>
</xsl:with-param name="delimiter-string"
select="substring($delimiter-string,2)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$so-far"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Pass in $CustomerSignerLname to be the "so-far" value when you call it.
This kind of thing is much nicer in XSLT 2.0, where XPath is stronger
and we even have user-defined functions.
Note: wild guess, not checked, tested or refined, comes without warranty.
Cheers,
Wendell
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--