CFDI40154

El valor del campo es un RFC inscrito no cancelado en el SAT o un RFC genérico nacional, y se registró el campo NumRegIdTrib.

In English NumRegIdTrib (a foreign tax number) must be left out unless the receiver has the generic foreign RFC XEXX010101000.

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
/cfdi:Comprobante/cfdi:Receptor
Test
$foreign or not(@NumRegIdTrib)

Checked with CFDI 4.0