javascriptxslt-2.0saxon-js

Precompile Load and Transform xml/sef files with client SaxonJS2.6


Try to display some .xml data file through a .sef.json transformed file (initially .xsl file) with SaxonJS 2.6 (SaxonJS26.rt.js/SaxonJS26.js); got two valid .xml and .sef.json files respectively The index.html file is as follows:

<html>
 <head>
  <meta charset="UTF-8" />
  <title>SxnTrnsct</title>
  <script type="text/javascript" src="../saxon-js2.6/SaxonJS2.rt.js"></script>
  <script type="text/javascript" src="js/sxn_tscrpt.js" ></script> 
 </head>
 <body>
  <h2>Smthn ..</h2>
  <div id="output"></div> 
 </body>
</html>

and that "sxn_tscrpt.js" goes like this:

"use strict"
var opts = {styleSheetLocation:"../xml/htrnsctstl.sef.json",sourceLocation:"../xml/trnsct.xml"}
onload = function()
    {
    SaxonJS.transform(opts,"async")
}

My os platform is windows 8/10, webserver is IIS, my CLIENT SaxonJS is 2.6 and the .sef file produced, has been generated through that xslt3 node.js module (for sure, the generated .sef.json file is valid, although understood could be certain escaping characters issues ...) Don't know what other "under the scene" details should be provided ... Anyway, the following opera browser errors were issued when launched that index.html (localhost):

SaxonJS2.rt.js:1113 Uncaught (in promise) XError: **No stylesheet supplied**
    at Object.transform (SaxonJS2.rt.js:1113:178)
    at onload (sxn_tscrpt.js:9:17)SaxonJS2.rt.js:772
GET http://localhost/mbPrct/xml/trnsct.xml 404 (Not Found)

These sort of problems has already been risen .. but ain't find nowhere a real, clear and reliable solution ..

If this very simple stuff could't be fixed, how one would expect of even work with SaxonJS (2.5 .. 2.6 .. ) ?

Thank you


Solution

  • Off the top of my head, I think you need stylesheetLocation and not styleSheetLocation.

    Documentation in https://www.saxonica.com/saxon-js/documentation2/index.html#!starting/installing and https://www.saxonica.com/saxon-js/documentation2/index.html#!api/transform confirms that.