Bug #5162


Failure when using collations in SaxonJS.XPath.evaluate

Added by Michael Kay over 1 year ago. Updated 11 months 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:


Raised here:

I was hoping to be able to specify a collation URI as the second parameter to fn:sort when using SaxonJS.XPath.evaluate, but it seems to throw an error: "Cannot read properties of null (reading 'toString')".

Actions #1

Updated by Debbie Lockett about 1 year ago

Note that I added a couple of tests back in December, but didn't manage to reproduce the problem (as commented in the initial forum post). See browser test xpath/evaluate05, and Node.js test xp019 (in xp/mocha_test.js).

Actions #2

Updated by Debbie Lockett about 1 year ago

  • Status changed from New to In Progress

Further test added (nodejs/iss5162 - see the "fn:sort using UCA collation" test currently marked skip) which actually reproduces the issue when using SaxonJS.XPath.evaluate from Node.js.

Actions #3

Updated by Debbie Lockett about 1 year ago

  • Assignee changed from Michael Kay to Debbie Lockett

The error is thrown from within an internal call on resolve-uri (for the collation URI). Apparently in this case, the supplied base is null (i.e. args[1] is an empty sequence), which is not being handled correctly in the resolve-uri code. The base comes from the evalContext.fixed.staticBaseURI (in XPathEval evaluate), which is null for the Node.js platform (but not for the browser platform - which explains why test xpath/evaluate05 didn't reproduce the problem).

Actions #4

Updated by Debbie Lockett about 1 year ago

  • Status changed from In Progress to Resolved
  • Applies to JS Branch 2 added
  • Fix Committed on JS Branch 2 added

Fix committed in resolve-uri code in CoreFn.js.

Actions #5

Updated by Debbie Lockett 11 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to SaxonJS 2.4

Bug fix applied in the SaxonJS 2.4 maintenance release.

Please register to edit this issue

Also available in: Atom PDF Tracking page