DT-CIUS-PT-020_10.2

The BT-22 when prefixed with '#WITHHOLDINGTAXAMOUNT@WITHHOLDINGTAX-000#', have to meet the defined format: decimal value with 2 decimal places and 13 unit places.

error: the document is invalid

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Context
//ubl:Invoice/cbc:Note | //cn:CreditNote/cbc:Note
Test
starts-with(normalize-space(.),'#WITHHOLDINGTAXAMOUNT@WITHHOLDINGTAX-') and not(matches(normalize-space(substring-before(substring-after(.,$wht20_10),'#')),'^([0-9]{1,13}.[0-9]{2})$'))

Checked with Portugal CIUS-PT Invoice (UBL), Portugal CIUS-PT Credit Note (UBL)