[Saxon-JS 2] Creating a JSON object

Martynas Jusevičius <martynas-tyFqBaoSXPC1Z/[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <CAE35Vmys=Qp36wAqF3xT+rp7rmSQpoOGtFEsy1iVreOofZM2aA@mail.gmail.com>
Hi,

Is there a quicker/cleaner way to create a JSON object and store it in
a variable than this?

        <xsl:variable name="js-statement" as="element()">
            <root statement="{{ subject:
SPARQLBuilder.SelectBuilder.var('child'), predicate:
SPARQLBuilder.SelectBuilder.var('{$predicate}'), object:
SPARQLBuilder.SelectBuilder.var('whatever') }}"/>
        </xsl:variable>
        <xsl:variable name="bgp"
select="ixsl:eval(string($js-statement/@statement))"/>

$bgp is later being used like this:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.