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:Order / cac:AllowanceCharge / cbc:Amount
/ ubl:Order / cac:AllowanceCharge / cbc:BaseAmount
/ ubl:Order / cac:TaxTotal / cbc:TaxAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:LineExtensionAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:TaxExclusiveAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:TaxInclusiveAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:AllowanceTotalAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:ChargeTotalAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PrepaidAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PayableRoundingAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PayableAmount
/ ubl:Order / cac:OrderLine / cac:LineItem / cbc:LineExtensionAmount
/ ubl:Order / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:Amount
/ ubl:Order / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:BaseAmount
/ ubl:Order / cac:AllowanceCharge / cbc:Amount
/ ubl:Order / cac:AllowanceCharge / cbc:BaseAmount
/ ubl:Order / cac:TaxTotal / cbc:TaxAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:LineExtensionAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:TaxExclusiveAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:TaxInclusiveAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:AllowanceTotalAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:ChargeTotalAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PrepaidAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PayableRoundingAmount
/ ubl:Order / cac:AnticipatedMonetaryTotal / cbc:PayableAmount
/ ubl:Order / cac:OrderLine / cac:LineItem / cbc:LineExtensionAmount
/ ubl:Order / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:Amount
/ ubl:Order / cac:OrderLine / cac:LineItem / cac:AllowanceCharge / cbc:BaseAmount