XSLT in JavaScript

Client-Side and Server-Side XSLT in JavaScript

Browsers have shipped an XSLT 1.0 engine for two decades, used through <?xml-stylesheet?> or XSLTProcessor. It is being removed; SaxonJS 726,956 brings XSLT 3.0 to browsers and Node.js 2,131 .

Subsections


XQuery with XQIB

XQuery In the Browser (XQIB) is a JavaScript library that runs XQuery expressions directly in the browser. At the time of writing, XQIB supports XQUF fully and XQFT partially.

The b: namespace prefix is reserved for XQIB's own built-in functions, such as b:dom() and b:addEventListener().
ch07-xqib-insert-demo.htmlHTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>XQIB: Sample page</title>
    <meta charset="UTF-8"/>
    <script type="text/javascript"
            src="mxqueryjs/mxqueryjs.nocache.js"></script>
    <script type="application/xquery">
      declare updating function local:onclick($loc, $evtObj) {
        insert node <hr color="red"/>
          as last into b:dom()//body
      };
      b:addEventListener
        (b:dom()//input, "onclick", local:onclick#2)
    </script>
  </head>
  <body>
    <h1>Insert example</h1>
    <input type="button" value="Click to add a line!"/>
  </body>
</html>

Courtesy of http://www.xqib.org/js/Update.html.