HAP1650-8a

The buyer is a public administration (NIF …), so its administrative centres must give all three DIR3 codes: the accounting office (01), the managing body (02) and the processing unit (03)….

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
/*:Facturae/*:Parties/*:BuyerParty
Test
not(matches(string($nif), '^[PQS]')) or (every $role in ('01', '02', '03') satisfies $centres[normalize-space(*:RoleTypeCode) = $role])

Checked with Facturae 3.2.2