Found this in my GatewayScript folder, written some time ago and never posted.
Long ago I found some Javascript code snippet somewhere converting epoch time (#seconds since Jan 1st 1970) into time face unicode symbol.
And I wanted to execute it with GatewayScript, but doing so directly was too easy. So I wanted to execute it from DataPower XSLT via "dp:gatewayscript()".
The trick is to write to the only filesystem accessible to XSLT output without accessing the XML Managament Interface. DataPower XSLT can output to "temporary:" folder via <dp:dump:nodes>.
There is one disadvantage when writing JavaScript that way -- you cannot write '<' nor '&' characters, because those get XML escaped.
There is another reason why doing this might not be what you want to do in production:
nodejs "eval()" function is disabled in GatewayScript for good (security) reasons.
You can (and should not, or only if you really know what you do) use below method to get something like nodejs "eval()" inside DataPower.
$ coproc2 doGatewayScript.xsl <(echo '<_/>') http://dp1-l3:2223; echo
🕔 2016-10-15T17:14:58Z
$ coproc2 doGatewayScript.xsl <(echo '<_/>') http://dp1-l3:2223; echo
🕠2016-10-15T17:15:02Z
$
$ cat doGatewayScript.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:dpfunc="http://www.datapower.com/extensions/functions"
xmlns:dp="http://www.datapower.com/extensions"
extension-element-prefixes="dp"
>
<xsl:output method="text"/>
<xsl:include href="store:///utilities.xsl"/>
<xsl:template match="/">
<xsl:variable name="js">
var d=~~(Date.now()/18e5+.5)%24;d+=d>=2?0:24;
session.output.write(String.fromCharCode(55357,56655+(d%2?23+d:d)/2));
</xsl:variable>
<dp:dump-nodes file=" 'doit.js' " nodes="$js"/>
<xsl:value-of
select="dp:gatewayscript('temporary:///doit.js')
/gatewayscript/result/text()"
/>
<xsl:text> </xsl:text>
<xsl:value-of select="dpfunc:zulu-time(date:seconds(date:dateTime()))"/>
</xsl:template>
</xsl:stylesheet>
$
Hermann.