title: How to use a <xsl:param> which contains a list?
body: <p>I am giving a list parameter to my Transformer in Java with the code:</p>
  <pre><code>List&lt;Long&gt; list = new ArrayList&lt;&gt;();
  list.add(9L);
  list.add(10L);
  transformer.setParameter(&quot;myList&quot;, list);
  </code></pre>
  <p>Then, I access it in my xsl file with this line:</p>
  <pre><code>&lt;xsl:param name=&quot;myList&quot;/&gt;
  </code></pre>
  <p>At this point I can display it with this line:</p>
  <pre><code>&lt;xsl:value-of select = &quot;$myList&quot;/&gt;
  </code></pre>
  <p>It works as expected, my result is:</p>
  <pre><code>[9, 10]
  </code></pre>
  <p>But I would like to access each element by its index. Basically something like this:</p>
  <pre><code> &lt;xsl:for-each select=&quot;my-tag1&quot;&gt;
       &lt;main-tag&gt;
           &lt;title&gt;&lt;xsl:value-of select = &quot;title-tag&quot;/&gt;&lt;/title&gt;
           &lt;number&gt;&lt;xsl:value-of select = &quot;$myList[position()]&quot;/&gt;&lt;/number&gt;
       &lt;/main-tag&gt;
   &lt;/xsl:for-each&gt;
  </code></pre>
  <p>To have something like this:</p>
  <pre><code>&lt;main-tag&gt;
      &lt;title&gt;title1&lt;/title&gt;
      &lt;number&gt;9&lt;/number&gt;
  &lt;/main-tag&gt;
  &lt;main-tag&gt;
      &lt;title&gt;title2&lt;/title&gt;
      &lt;number&gt;10&lt;/number&gt;
  &lt;/main-tag&gt;
  </code></pre>
  <p>But I get an error on &quot;$myList[position()]&quot; :</p>
  <pre><code>java.lang.ClassCastException: class org.apache.xpath.objects.XObject cannot be cast to class org.apache.xpath.objects.XNodeSet (org.apache.xpath.objects.XObject and org.apache.xpath.objects.XNodeSet are in unnamed module of loader 'app')
  </code></pre>