Message

Elements of data type amount cannot have more than 2 decimals (I.e. all amounts except unit price amounts)

Context
cbc:Amount | cbc:TaxAmount | cbc:LineExtensionAmount | cbc:PriceAmount | cbc:BaseAmount | cac:AnticipatedMonetaryTotal/cbc:*
Test
ancestor::node()/local-name() = 'Price' or string-length(substring-after(., '.')) <= 2
Usage
/ ubl:OrderChange / cac:AllowanceCharge / cbc:Amount
/ ubl:OrderChange / cac:AllowanceCharge / cbc:BaseAmount
/ ubl:OrderChange / cac:TaxTotal / cbc:TaxAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:LineExtensionAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:TaxExclusiveAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:TaxInclusiveAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:AllowanceTotalAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:ChargeTotalAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:PrepaidAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:PayableRoundingAmount
/ ubl:OrderChange / cac:AnticipatedMonetaryTotal / cbc:PayableAmount
/ ubl:OrderChange / cac:OrderLine / cac:LineItem / cbc:LineExtensionAmount
/ ubl:OrderChange / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:Amount
/ ubl:OrderChange / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:BaseAmount