-
Notifications
You must be signed in to change notification settings - Fork 36
Description
We notice that our XPath evaluator (Saxon) struggles with a specific XPath, which we have traced back to (the value of) an assertion on BT-539-Lot:
{ND-LotAwardCriteria} ${every number:$ordImp in BT-541-Lot-WeightNumber[BT-5421-Lot == 'ord-imp'] satisfies (format-number($ordImp, '#') == string($ordImp))}
This rule asserts that the values of BT-541-Lot-WeightNumber are integers (if BT-5421-Lot equals 'ord-imp').
The [email protected] transpiles this to the following XPath:
every $ordImp in cac:SubordinateAwardingCriterion/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:AwardCriterionParameter[efbc:ParameterCode/@listName='number-weight']/efbc:ParameterNumeric[../efbc:ParameterCode/normalize-space(text()) = 'ord-imp']/number() satisfies (format-number($ordImp, '#') = format-number($ordImp, '0,##########'))
The error (which is rather cryptic, but in any case clearly problematic):
We found that rewriting the EFX expression to:
{ND-LotAwardCriteria} ${every number:$ordImp in BT-541-Lot-WeightNumber[BT-5421-Lot == 'ord-imp'] satisfies $ordImp % 1 == 0}
yields a simpler XPath (which does not give an error):
every $ordImp in cac:SubordinateAwardingCriterion/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/efext:EformsExtension/efac:AwardCriterionParameter[efbc:ParameterCode/@listName='number-weight']/efbc:ParameterNumeric[../efbc:ParameterCode/normalize-space(text()) = 'ord-imp']/number() satisfies ($ordImp mod 1 = 0)
We can rely on our tailoring pipeline to rewrite this EFX expression, but I suppose we might not be the only ones with this issue, so we wanted to share this solution. We will however need to check every future releases to see if similar expressions are introduced (so we may add corresponding rewrite rules to our pipeline), unless OP would be willing to consider integrating this alternative EFX expression into the SDK as the default way to express an integer test.