Just wondering what the best way of spliting values seperated by commas is.
For example i have a document type with a checkbox choice which when more than one box is ticked the umbraco.config file
<data alias="list">example1,example2,example4</data>
I want to in my xslt file split these values out and then use them in xsl:if tags.
I found this online - and have used it for separating, but is a bit of an arse and havent figured out how to use the values for xsl:if 's etc....
Code: <xsl:template match="Record">
<tr>
<xsl:call-template name="divide">
<xsl:with-param name="to-be-divided" select="."/>
<xsl:with-param name="delimiter" select="','"/>
</xsl:call-template>
</tr>
</xsl:template>
<xsl:template name="divide">
<xsl:param name="to-be-divided"/>
<xsl:param name="delimiter"/>
<xsl:choose>
<xsl:when test="contains($to-be-divided,$delimiter)">
<td><xsl:value-of
select="substring-before($to-be-divided,$delimiter)"/></td>
<xsl:call-template name="divide">
<xsl:with-param name="to-be-divided"
select="substring-after($to-be-divided,$delimiter)"/>
<xsl:with-param name="delimiter" select="','"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="$to-be-divided"/></td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I checked around a bit more and saw about tokenize then checked on this forum and saw someone use Exslt.ExsltStrings:tokenize but i cant figure out how to get it to work. Am i on the right tracks with this?/
Anyone know the best way to split the value for use?