0

The specific assert condition is evaluated differently by Xerces and Saxon validation engine in oxygenxml editor.

I have created a xsd schema (version 1.1) and the corresponded xml test file following the created schema. The xml file is correct according to XMLSpy 2019.

The validation of the test xml file in oxygenxml 21.0 fails if Xerces is used as validation schema.

At the same time the validation is successful if Saxon is used as validation engine.

Has the Xerces implementation issues with such particular assert clause

<xs:complexType>
    <xs:sequence>
        <xs:element name="scenario" type="Scenario"/>
        <xs:element name="year" type="StressYear"/>
        <xs:element name="position" type="STACreditPosition" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:assert test="every $pos in ./position satisfies not(($pos/geography lt $pos/preceding-sibling::position[1]/geography) or (($pos/geography eq $pos/preceding-sibling::position[1]/geography) and ($pos/creditAssetClass le $pos/preceding-sibling::position[1]/creditAssetClass)))"/>
</xs:complexType>

I expect that the validation is successful with Xerces engine.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
AndyM
  • 41
  • 5

1 Answers1

0

You haven't given us enough information to investigate this fully, but you are giving the processor a difficult job with the expression $pos/geography lt ..., because the evaluation depends on the data type of the geography element. The specification says that the assertion should be evaluated using the typed value of geography (for example xs:integer if that's the way it's defined), but this is quite hard to achieve because the expression is evaluated before validation has been completed. So although the result is well-defined according to the specification, you might get more interoperable results if you avoid relying on this feature of the specification, and do an explicit type conversion:

<xs:assert test="every $pos in ./position satisfies
 not(($pos/geography/xs:integer(.) lt $pos/preceding-sibling::position[1]/geography/xs:integer(.)) ..."/>
Michael Kay
  • 156,231
  • 11
  • 92
  • 164