Hi Yitzhak,
   I studied one of the XPath expressions in the <assert> of your XSD. This is below,

if (abs((ContractValueShortTerm + ContractValueLongTerm) - ContractValue) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()

In this XPath, one of the evaluations you're doing is, abs(..) le subsequence(..).

The fn:abs(..) return type is numeric?

and fn:subsequence(..) return type is item()*

As per the XPath 2.0 spec, the semantics of the operator "le" says (ref, https://www.w3.org/TR/xpath20/#id-value-comparisons),

The value comparison operators are eq, ne, lt, le, gt, and ge. Value comparisons are used for comparing single values.
3. If the atomized operand is a sequence of length greater than one, a type error is raised [err:XPTY0004].

I suspect, since subsequence is returning a sequence of cardinality/size greater than one, the Xerces's <assert> XPath processor is rightly emitting an error XPTY0004.  

On Tue, Jul 3, 2018 at 11:48 PM, Yitzhak Khabinsky <Yitzhak.Khabinsky@millicom.com> wrote:

Hello,

 

Just started to use today recently released Xerces-J 2.12.0 for XSD 1.1 validations.

Unfortunately, my very first test failed right away with multiple errors.

 

My test case XML/XSD is passing XSD 1.1 validation using Saxon 9.8.0.12 without any problem.

Please advise.

 

Running custom validation engine Xerces-J Validator XSD 1.1...

 

 

d:\Temp\CDW\HOME>"c:\Program Files\Java\jre1.8.0_172\bin\java.exe"  -Xms512m -Xmx1024m -Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar jaxp.SourceValidator -xsd11 -i "file:///d:/Temp/CDW/IFRS/IFRS15_CBC_Out/TanzaniaZantel/id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml"

 

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus, 'TERMINATION')) then true() (: Ignore the rest :)     else if (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1 + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth + IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth + IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 + IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 + IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:82:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 + IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus, 'TERMINATION')) then true() (: Ignore the rest :)     else if (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1 + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth + IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth + IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 + IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 + IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:125:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 + IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus, 'TERMINATION')) then true() (: Ignore the rest :)     else if (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1 + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth + IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth + IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 + IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 + IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:168:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 + IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if (starts-with(RecordMonthStatus, 'TERMINATION')) then true() (: Ignore the rest :)     else if (abs((IFRSBillingPreviousMonth + IFRSBillingCurrentMonth + IFRSBillingYear1 + IFRSBillingYear2 + IFRSBillingYear3) - TransactionPriceTotal) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenueCurrentMonth eq 0) or (abs((IFRSBillingCurrentMonth + IFRSAdjustmentsCurrentMonth) - IFRSRevenueCurrentMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if ((MaterialCategory eq 'CPTC' and IFRSRevenuePreviousMonth eq 0) or (abs((IFRSBillingPreviousMonth + IFRSAdjustmentsPreviousMonth) - IFRSRevenuePreviousMonth) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1))) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear1 + IFRSAdjustmentsYear1) - IFRSRevenueYear1) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear2 + IFRSAdjustmentsYear2) - IFRSRevenueYear2) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:211:29: cvc-assertion: Assertion evaluation ('if (abs((IFRSBillingYear3 + IFRSAdjustmentsYear3) - IFRSRevenueYear3) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'ContractLineItem' on schema type '#AnonType_ContractLineItem' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (some $x in ContractLineItems/ContractLineItem/RecordMonthStatus satisfies starts-with($x, 'TERMINATION')) then true() (: Ignore the rest :)     else if (abs(sum(ContractLineItems/ContractLineItem/(IFRSRevenuePreviousMonth + IFRSRevenueCurrentMonth + IFRSRevenueYear1 + IFRSRevenueYear2 + IFRSRevenueYear3)) - ContractLiabilityFinancingEffect + ContractAssetFinancingEffect - sum(ContractLineItems/ContractLineItem/RelativeStandaloneSellingPriceTotal)) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs((ContractAsset + ContractLiability - ContractInterestIncome - ContractInterestExpense) - sum(ContractLineItems/ContractLineItem/IFRSAdjustmentsCurrentMonth)) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs((ContractValueShortTerm + ContractValueLongTerm) - ContractValue) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs((ContractValueShortTermT0 + ContractValueLongTermT0) - ContractValueT0) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs((ContractAssetShortTerm + ContractAssetLongTerm) - ContractAsset) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs((ContractLiabilityShortTerm + ContractLiabilityLongTerm) - ContractLiability) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

[Error] id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml:213:8: cvc-assertion: Assertion evaluation ('if (abs(ContractNetContractPositionT0 - sum(ContractLineItems/ContractLineItem[./MaterialCategory eq 'HARDWARE']/(RelativeStandaloneSellingPriceTotal - TransactionPriceTotal)) + sum(ContractLineItems/ContractLineItem[./MaterialCategory = 'FEE']/TransactionPriceTotal)) le subsequence((0.05, 0.1, 0.05, 0.05, 0.05, 0.05, 0.05), index-of(('BO','CO','GT','HN','PY','SV','TZ'), CountryCode), 1)) then true() else false()') for element 'r' on schema type '#AnonType_r' did not succeed. XPTY0004 - Value does not match a required type.

file:///d:/Temp/CDW/IFRS/IFRS15_CBC_Out/TanzaniaZantel/id0001_TZ20180100_IFRS15_CBCOutput_3TZ005.xml: 278 ms

 

 

 

 

Regards,

Yitzhak Khabinsky

Technical Services Lead

Millicom International Services LLC

396 Alhambra Circle, Suite 1100

Coral Gables, FL  33134

Skype4B: +1 (305) 445-4172

Tel: (954) 684-8673

yitzhak.khabinsky@millicom.com

www.millicom.com

 




--
Regards,
Mukul Gandhi