Bug #3067


SaxonJS.min.js not working

Added by Jan Pour over 7 years ago. Updated almost 7 years ago.

Start date:
Due date:
% Done:


Estimated time:
Applies to JS Branch:
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Contact person:
Additional contact persons:


I was trying to run Book List sample application using new distribution ( But when using SaxonJS.min.js it returned:

  "name": "XError",
  "message": "No checksum found in SEF",
  "code": "SXJS0006"

When using SaxonJS.js it was running ok.

Actions #1

Updated by Debbie Lockett over 7 years ago

  • Status changed from New to In Progress

Thanks for reporting the problem. Looks like I may need to regenerate the SEFs for the samples.

Actions #2

Updated by Jan Pour over 7 years ago

Maybe misunderstanding.. I grabbed application files: books.xml, books.xsl, books.css, books.html from the documentation page and tryied to run it on my environment.

So I compiled books.xsl to SEF file using SaxonEE9-7-0-14J. My SEF file ends with processing instruction: - it is not missing.

I don't understand the difference between SaxonJS.js and SaxonJS.min.js other than size - they should work same, no? So why SaxonJS.min.js shows that error? Thanks

Actions #3

Updated by Debbie Lockett over 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100
  • Found in version set to 0.9.1
  • Fixed in version set to

Sorry, you are right - the problem was indeed a difference in the behaviour of the minified version, which absolutely should not be the case.

The problem was to do with looking for a Sigma symbol in the checksum processing instruction. In the minified version of Saxon-JS 0.9.1 this had been converted to a literal symbol, rather than "\u03A3" in the non-minified version.

Fixed by replacing with String.fromCharCode(931).

We have done a quick re-build to fix this bug. Please find the new Saxon-JS download on the website

Actions #4

Updated by Michael Kay over 7 years ago

To add to Debbie's response:

The JS code is looking for a processing instruction whose name is the single character "Greek capital letter Sigma". The comparison was written (in effect)

if (name == "\u03A3")

In the minified code this had been converted to

if (name == "Σ")

The minified code is thus vulnerable to encoding problems in a way that the original code is not. If the encoding is mis-recognized, the name of the checksum processing instruction will not match this "if" condition, hence the error message that the checksum was not found.

It's not possible for a JS file to identify its own encoding/charset; it relies on the HTML page to do this, and because we can't trust the HTML page to do this correctly, we should avoid having non-ASCII characters in the JS. The patch achieves this by rewriting this code as (effectively)

if (name == String.fromCharCode(931))
Actions #5

Updated by Debbie Lockett almost 7 years ago

  • Fixed in JS Release set to Saxon-JS
  • Applies to JS Branch 0.9 added
  • Fix Committed on JS Branch 0.9 added

Please register to edit this issue

Also available in: Atom PDF Tracking page