10. But why?

Why did that example run a stylesheet?

The secret sauce is another method on the SaxonJS object, transform().

The script element that you added:

<script>
  window.onload = function() {
    SaxonJS.transform(
      { stylesheetLocation: "ex02.sef.json" },
      "async");
  }
</script>

is evaluated by the JavaScript engine in the browser. That runs the “transform” function, which runs the stylesheet.