xsl-list
[Top] [All Lists]

Re: [xsl] String Tokenizer in XSLT

2006-12-06 10:34:10
Hi Vikram,
Thanks for the help. I was struggling about the recursive calling in XSLT.It is real quick eye opener :)


Regards,
Senthil
On Dec 6, 2006, at 9:25 AM, Dhunta, Vikram (GE, Corporate) wrote:



You could use a tempate defined to split by , and return the elements-

        <xsl:template name="splitByComma">
        <xsl:param name="str"/>
                <xsl:choose>
                <xsl:when test="contains($str,',')">
                'DO SOMETHING WITH THE VALUE IN
{substring-before($str,',')}
                        <xsl:value-of
select="substring-before($str,',')"/></option>
                <xsl:call-template name="splitByComma">
                <xsl:with-param name="str"
select="substring-after($str,',')"/>
                </xsl:call-template>
                </xsl:when>
                <xsl:otherwise>
                'DO SOMETHING WITH THE VALUE IN {$str}
                </xsl:otherwise>
                </xsl:choose>
        </xsl:template>

You call this by
                <xsl:call-template name="splitByComma">
                        <xsl:with-param name="str" select="SM"/>
                </xsl:call-template>

-----Original Message-----
From: Senthilkumaravelan Krishnanatham [mailto:senthil(_at_)apple(_dot_)com]
Sent: Wednesday, December 06, 2006 12:19 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] String Tokenizer in XSLT

Hi All,
Is there any function available in XSL to tokenize the string with the
Delimiter?

My XML node looks like
<SM>1,2,3</SM>
I want to split  the text value by delimiting , and process the same.

Thanks,
Senthil

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>