I'm trying to access a specific element in an array depending on the value of the current date in an XML file.
For example, in the XML
<CurrentMonth>5</CurrentMonth>
Then, in the XSLT - this is set as a variable as
<xsl:variable name="current-month">
xsl:value-of select="//CurrentMonth" />
</xsl:variable>
I also have declared an array of the "Month names" as
<xsl:variable name="array" as="element()*">
<Item>Jan</Item>
<Item>Feb</Item>
<Item>Mar</Item>
<Item>Apr</Item>
<Item>May</Item>
<Item>Jun</Item>
<Item>Jul</Item>
<Item>Aug</Item>
<Item>Sept</Item>
<Item>Oct</Item>
<Item>Nov</Item>
<Item>Dec</Item>
</xsl:variable>
Is it possible in XSLT to return the name of the month (e.g. "Jan") by using a variable as an index for the array?
Example :
<xsl:value-of select="$array[$current-month]">
The code above is throwing me
[FATAL]: Error checking type of the expression 'filter-expr(variable-ref(array/result-tree)
Thanks in advance.