Saxon-CE is an XSLT 2.0 processor that runs in a browser. It is compiled for JavaScript and provides a high level of JavaScript compatibility. JavaScript nodes, DOMs, numbers, strings, booleans, and arrays (converted to XSLT 2.0 sequences) work relatively easily through the JavaScript / XSLT interface.
In your particular case, you have various options in Saxon-CE; you can directly call an existing or entered JavaScript function using ixsl: call (), or you can use ixsl: get () to get the value of a variable. Or you can do it all from your XSLT 2.0:
[Edited with corrections mentioned in the comment]
Here the same code as the text instead of the graphic - without formatting
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f="urn:local-function" xmlns:a="urn:source-xml" extension-element-prefixes="ixsl" version="2.0" > <xsl:template match="/"> <xsl:variable name="urlparams" select="ixsl:get( ixsl:get(ixsl:window(),'location'), 'search')" as="xs:string"/> <xsl:variable name ="pairs" select="tokenize(substring($urlparams,2), '&')" as="xs:string*"/> <xsl:variable name="value" select="f:getValue($pairs)"/> <p>value: <xsl:value-of select="$value"/></p> <xsl:choose> <xsl:when test="a:id eq $value"> <xsl:value-of select="a:name"/> </xsl:when> </xsl:choose> </xsl:template> <xsl:function name="f:getValue" as="xs:string*"> <xsl:param name="pairs" as="xs:string*"/> <xsl:sequence select="for $p in $pairs, $v in substring-before($p, '=') return if ($v eq 'value') then substring($p, string-length($v) + 2) else ()"/> </xsl:function> </xsl:transform>
source share