extract value from an array in xslt
<p>I have variable 'temperatureQualifier'  whose type is array. I need to read that array variable and extract each value from the array and use it in my XSLT.</p>

<p><strong>Sample Input XML is</strong> </p>

<pre><code>&lt;document&gt;
&lt;item&gt;
    &lt;gtin&gt;1000909090&lt;/gtin&gt;
    &lt;flex&gt;
        &lt;attrGroupMany name="tradeItemTemperatureInformation"&gt;
            &lt;row&gt;
                &lt;attr name="temperatureQualifier"&gt;[10, 20, 30, 40]&lt;/attr&gt;
            &lt;/row&gt;

        &lt;/attrGroupMany&gt;
    &lt;/flex&gt;
&lt;/item&gt;
&lt;/document&gt;
</code></pre>

<p><strong>Desired Output XML should be</strong> </p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;CatalogItem&gt;
&lt;RelationshipData&gt;
  &lt;Relationship&gt;
     &lt;RelationType&gt;Item_Master_TRADEITEM_TEMPERATURE_MVL&lt;/RelationType&gt;
     &lt;RelatedItems&gt;
        &lt;Attribute name="code"&gt;
           &lt;Value&gt;10&lt;/Value&gt;
        &lt;/Attribute&gt;
         &lt;Attribute name="code"&gt;
           &lt;Value&gt;20&lt;/Value&gt;
        &lt;/Attribute&gt;
         &lt;Attribute name="code"&gt;
           &lt;Value&gt;30&lt;/Value&gt;
        &lt;/Attribute&gt;
         &lt;Attribute name="code"&gt;
           &lt;Value&gt;40&lt;/Value&gt;
        &lt;/Attribute&gt;
     &lt;/RelatedItems&gt;
  &lt;/Relationship&gt;
&lt;/RelationshipData&gt;
&lt;/CatalogItem&gt;
</code></pre>

<p><strong>I am using the below XSLT but it is giving me all values in 1 node only.</strong></p>

<pre><code>&lt;xsl:stylesheet 
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

&lt;xsl:output indent="yes"/&gt;


&lt;xsl:template match="document"&gt; 
    &lt;CatalogItem&gt;
        &lt;RelationshipData&gt;
            &lt;Relationship&gt;
                &lt;RelationType&gt;Item_Master_TRADEITEM_TEMPERATURE_MVL&lt;/RelationType&gt;  
                &lt;RelatedItems&gt;      


                    &lt;xsl:for-each select="item/flex/attrGroupMany[@name ='tradeItemTemperatureInformation']/row"&gt;                       

                        &lt;Attribute name="code"&gt;
                            &lt;Value&gt;
                                &lt;xsl:value-of select="attr[@name='temperatureQualifier']"/&gt;
                            &lt;/Value&gt;
                        &lt;/Attribute&gt;


                    &lt;/xsl:for-each&gt;
                &lt;/RelatedItems&gt;
            &lt;/Relationship&gt;
        &lt;/RelationshipData&gt;
    &lt;/CatalogItem&gt;

&lt;/xsl:template&gt; 

&lt;/xsl:stylesheet&gt;
</code></pre>

<p>Note: Number of value in array can be 1 or more than 1. 
Example for single value array is [10]</p>

<p>Example for multie value array is [10, 20, 30, 40]</p>