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:
Code:
<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.
I want to take the tokenized values to a variable and access it like an array like TestToken[1] (As shown the code above)
Any help appreciated.
Thanks in advance
Priby