Is there a simple way to have an extension function in XSLT 1.0 written in javascript return a node-set?
I could create a new java class for this, but I would rather just put some code in the script itself.
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.
I have the following simple script:
<msxsl:script language="JScript" implements-prefix="custom">
function xml (input) {
var x = input.split(";");
return x.toString();
}
</msxsl:script>
which returns a string, and hence no problem calling the function in Xpath expressions.
What I would like to have, is a node-set result. But when I change my script to
<msxsl:script language="JScript" implements-prefix="custom">
function xml (input) {
var x = input.split(";");
return x;
}
</msxsl:script>
then calling the function gives an error because the array is not automatically converted to a node-set.
I looked at arrays-with-java-xslt-extensions but that's more in the line of creating a new class for this, which I wish to avoid for now.
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?