Closed bertrand-lorentz closed 3 weeks ago
With ph-schematron-pure 8.0.2, the following schematron will always cause a failed assert:
<let name="a" value="1"/> <let name="a-plus-one" value="$a + 1"/> <assert role="ERROR" test="$a-plus-one = 2">error message</assert>
I would expect the test to be always true.
After some debugging, it seems the declaration of a-plus-one is evaluated before the declaration of a. So a-plus-one will then be equal to 1.
a-plus-one
a
The current behavior is probably because the variables are stored in a sorted Map: https://github.com/phax/ph-schematron/blob/master/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java#L49
I guess using a Map that preserves insertion order would correct this.
Part of the 8.0.3 release
With ph-schematron-pure 8.0.2, the following schematron will always cause a failed assert:
I would expect the test to be always true.
After some debugging, it seems the declaration of
a-plus-one
is evaluated before the declaration ofa
. Soa-plus-one
will then be equal to 1.The current behavior is probably because the variables are stored in a sorted Map: https://github.com/phax/ph-schematron/blob/master/ph-schematron-pure/src/main/java/com/helger/schematron/pure/binding/xpath/PSXPathVariables.java#L49
I guess using a Map that preserves insertion order would correct this.