Need help in using exslt function str:tokenize

View: New views
1 Messages — Rating Filter:   Alert me  

Need help in using exslt function str:tokenize

by priby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I am trying to tokenize a string that has empty space in between the delimiters(comma is used as delimiter).

I have the XSL code as shown below:

        <xsl:variable name="Test" select="',BBBB,,DDDD,EEEE'"/>
      <xsl:variable name="TestToken" select="str:tokenize($Test,',')"/>

<xsl:message>Value of first is ....<xsl:value-of select="$TestToken[1]"/></xsl:message>
<xsl:message>Value of second  is ....<xsl:value-of select="$TestToken[2]"/></xsl:message>
<xsl:message>Value of Third is ....<xsl:value-of select="$TestToken[3]"/></xsl:message>
<xsl:message>Value of Fourth is ....<xsl:value-of select="$TestToken[4]"/></xsl:message>
<xsl:message>Value of Fifth is ....<xsl:value-of select="$TestToken[5]"/></xsl:message>

Upon executing this code, I get the output as follows:

Value of first is ....BBBB
Value of second  is ....DDDD
Value of Third is ....EEEE
Value of Fourth is ....
Value of Fifth is ....


But my required output is as below:

Value of first is ....
Value of second  is ....BBBB
Value of Third is ....
Value of Fourth is ....EEEE
Value of Fifth is ....DDDD

I would like to know how to get the required output using str:tokenize.

Any help appreciated.

Thanks in advance
Priby