Project

Profile

Help

Collation URI for sort in SaxonJS.XPath.evaluate

Added by Alf Eaton 3 months ago

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')".

For example:

sort(//ref/@id ! tokenize(., '\s'), 'http://saxon.sf.net/collation?alphanumeric=yes')

or

sort(//ref/@id ! tokenize(., '\s'), 'http://www.w3.org/2013/collation/UCA?numeric=yes')

Is this the right way to apply a collation URI to a sort?


Replies (3)

Please register to reply

RE: Collation URI for sort in SaxonJS.XPath.evaluate - Added by Alf Eaton 2 months ago

Here's a more straightforward example:

sort(('C', 'A', 'B'))

=> correctly sorts the list

sort(('A', 'B', 'C'), 'http://www.w3.org/2013/collation/UCA?numeric=yes')

=> Cannot read properties of null (reading 'toString')

RE: Collation URI for sort in SaxonJS.XPath.evaluate - Added by Debbie Lockett about 1 month ago

Alf, which version of SaxonJS are you using? And could you provide more details of your invocation? I have not been able to reproduce your error with SaxonJS 2 in the browser. For instance the following produces the expected result:

SaxonJS.XPath.evaluate("sort(('C', 'A', 'B'), 'http://www.w3.org/2013/collation/UCA?numeric=yes')");
    (1-3/3)

    Please register to reply