| Author |
tokenize function in XSL
|
D Preethi
Ranch Hand
Joined: May 24, 2008
Posts: 68
|
|
Hi All, I am trying to use the tokenize function in XSL to separate a string with ':' characters. However, I am getting a parse error for tokenize method when I use it. Could you please tell me where I am going wrong? This is the code - <xsl:template name="testList"> <xsl:param name="string" /> <xsl:if test="$string and string-length($string) > 0"> <xsl:for-each select="tokenize($string,':')"> <xsl:choose> <xsl:when test="position()=1"> <FirstName> <xsl:value-of select="." /> </FirstName> </xsl:when> <xsl:when test="position()=2"> <MiddleName> <xsl:value-of select="." /> </<MiddleName> </xsl:when> <xsl:when test="position()=3"> <LastName> <xsl:value-of select="." /> </LastName> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:if> </xsl:template>
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
The tokenize function is part of XSLT 2.0. It's quite likely that you aren't using a transformer which supports XSLT 2.0. Did you find out about this function from an online tutorial? There is at least one online tutorial (w3schools) which doesn't bother to tell you which functions are only in XSLT 2.0. I always recommend people to not use that one.
|
 |
D Preethi
Ranch Hand
Joined: May 24, 2008
Posts: 68
|
|
|
Yes Paul. I just discovered that. I was using XSL 1.0 , not 2.0 and w3schools is what I was referring to. So, couldn't make that out. Thanks for your reply. May be we should look at websites which give these details before using the functions.
|
 |
 |
|
|
subject: tokenize function in XSL
|
|
|