I have a variable as below:
<xsl:variable name="ARRAY">
One,Two,Three,Four
</xsl:variable>
With XSLT 2.0 I used tokenize functions and I set an array variable:
<xsl:variable name="tokenizedSample" select="tokenize($ARRAY,',')"/>
and get array value with:
<xsl:value-of select="$tokenizedSample[1]"/>
Unfortunately I must use XSLT 1.0 and I don't know as replace this situation... I found some examples to create a template as below:
<xsl:template name="SimpleStringLoop">
<xsl:param name="input"/>
<xsl:if test="string-length($input) > 0">
<xsl:variable name="v" select="substring-before($input, ',')"/>
<field>
<xsl:value-of select="$v"/>
</field>
<xsl:call-template name="SimpleStringLoop">
<xsl:with-param name="input" select="substring-after($input, ',')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
and calling this template as below:
<xsl:variable name="fields">
<xsl:call-template name="SimpleStringLoop">
<xsl:with-param name="input" select="$ARRAY"/>
</xsl:call-template>
</xsl:variable>
and accessing to this new array with:
<xsl:value-of select="$fields[1]"/>
but doesn't work.
How can I do?
I would like a XSLT 1.0 variable as array because I want read it with for example:
$newArray[1]
Thanks.