tags:

views:

198

answers:

1

I have a parameter in which I'm having information like:

"item1,item2,item3,item4"

So this could be 1 or 2 or 3 or 4.

I want to split it and process it individually. Any idea how to achieve this?

A: 

Use exslt, these extensions are available for most XSLT processors.

Here is an implementation of str:split as an XSLT template. It is called like so:

<xsl:variable name="values">
    <xsl:text>item1,item2,item3,item4</xsl:text>
</xsl:variable>

<xsl:call-template name="str:split">
   <xsl:with-param name="string" select="$values" />
   <xsl:with-param name="pattern" select="','" />
</xsl:call-template>
Lachlan Roche