title: How can make an XSLT Javascript extension function return a node-set?
body: <p>Is there a simple way to have an extension function in XSLT 1.0 written in javascript return a node-set?<br>
  I could create a new java class for this, but I would rather just put some code in the script itself.<br>
  When this can be done in another scripting language supported by all or most XSLT processors (VB script? Groovy? C#?), then that's OK too of course.</p>
  
  <p>I have the following simple script:</p>
  
  <pre><code>&lt;msxsl:script language="JScript" implements-prefix="custom"&gt;
      function xml (input) {
          var x = input.split(";");
          return x.toString();
      }
  &lt;/msxsl:script&gt;
  </code></pre>
  
  <p>which returns a string, and hence no problem calling the function in Xpath expressions.<br>
  What I would like to have, is a node-set result. But when I change my script to</p>
  
  <pre><code>&lt;msxsl:script language="JScript" implements-prefix="custom"&gt;
      function xml (input) {
          var x = input.split(";");
          return x;
      }
  &lt;/msxsl:script&gt;
  </code></pre>
  
  <p>then calling the function gives an error because the array is not automatically converted to a node-set.</p>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/4920633/arrays-with-java-xslt-extensions">arrays-with-java-xslt-extensions</a> but that's more in the line of creating a new class for this, which I wish to avoid for now.</p>
  
  <p>So which statements should be added to the script in order to transform the array into a node-set, allowing the function call to be used in Xpath expressions?</p>