title: jMeter - XPath Extractor does not let BSF Post Processor (with javascript code) to access multiple extracted matches
body: <p>I have an XML response from server (SOAP) and I'm getting multiple values in it. XPath extracts all the values and stores them internally like Match_1, Match_2, Match_3, etc.
  But I can't access them neither via BSF Post Processor nor via JavaScript code pasted in XML. It just refuses to return values then I address to them like this: <code>${Match_1}</code>.</p>
  
  <p>Example:</p>
  
  <p>Response returns multiple <code>contentGroupID</code> values.<br>
  Debug Sampler reveals them:</p>
  
  <ul>
  <li>contentGroupID=67 </li>
  <li>contentGroupID_1=67 </li>
  <li>contentGroupID_2=50</li>
  <li>contentGroupID_3=38 </li>
  <li>contentGroupID_4=54 </li>
  <li>contentGroupID_5=46</li>
  </ul>
  
  <p>We need to use each of these values in the next single request, so we add a code inside XML in place where we need those values to sit:</p>
  
  <pre><code>${__javaScript
  (myOutput =''; var names = {};
  for (var i = 1; i &lt;= ${contentGroupID_matchNr}; i++) 
  {names[i] = "${contentGroupID_" + i + "}";}
  for (var j = 1; j &lt;= ${contentGroupID_matchNr}; j++) 
  {myOutput = 
  myOutput + '&lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;' + names[j] + '&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;';},
  myOutput)
  }
  </code></pre>
  
  <p>Here we place the part of XML with values <code>&lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;' + ids + '&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;</code> as many times as matches were found by XPath.</p>
  
  <p>But the magic does <strong>not</strong> happen. The request is sent as follows:</p>
  
  <pre><code>&lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;${contentGroupID_1}&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;
  &lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;${contentGroupID_2}&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;
  &lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;${contentGroupID_3}&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;
  &lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;${contentGroupID_4}&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;
  &lt;ns8:forContentGroupId&gt;&lt;ns2:id&gt;${contentGroupID_5}&lt;/ns2:id&gt;&lt;/ns8:forContentGroupId&gt;
  </code></pre>
  
  <p>The same happens in case I set BSF Post Processor with JavaScript code and add a variable in XML. </p>
  
  <p>The question is: <strong>how the hell can one access those magical values?</strong></p>
  
  <p>P.S. Everything works great then I use ForEach Controller. But the trick is I need to make single request with all the values, not multiple requests one after another.</p>