Project

Profile

Help

Bug #5654

closed

SaxonJS restriction: don't check parameters are supplied if they aren't used

Added by Debbie Lockett over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Low
Category:
XSLT Conformance
Sprint/Milestone:
Start date:
2022-08-19
Due date:
% Done:

0%

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

Description

It is documented (https://www.saxonica.com/saxon-js/documentation2/index.html#!conformance/xslt30) that

If a required stylesheet parameter is not actually used, then Saxon does not check that a value has been supplied.

The xslt30 test initial-mode-003 is included in the exceptions for this reason.

However the restriction only arises because of a bug in the code which attempts to check values are supplied for required parameters:

        requiredParams.map(function (name) {
            if (typeof context.fixed.options.stylesheetParams.get(Atomic.XS.QName.fromEQName(name)) === "undefined") {
                throw new XError("No value has been provided for required stylesheet parameter '" + name + "'", "XTDE0050");
            }
        });

stylesheetParams is a HashTrie. Rather than doing HashTrie.get() (which returns an empty array representing an empty sequence when the key is not in the hashtrie, not undefined), we should be using HashTrie.containsKey().

I'm proposing we fix this for SaxonJS 3, but leave the restriction for SaxonJS 2 (rather than make a change between maintenance releases).

Actions #1

Updated by Debbie Lockett over 1 year ago

  • Status changed from New to Resolved
  • Fix Committed on JS Branch Trunk added

Code fix committed on main branch. The requiredParams check is now:

if (!context.fixed.options.stylesheetParams.containsKey(Atomic.XS.QName.fromEQName(name))) 

Also committed updates on the main branch: to the documentation to remove the restriction note; and to the xslt30 exceptions file to remove the exception for test initial-mode-003.

Actions #2

Updated by Norm Tovey-Walsh over 1 year ago

  • Sprint/Milestone set to SaxonJS 3.0

Please register to edit this issue

Also available in: Atom PDF Tracking page