NFE-511
Rejeição: Não é de Operação com Exterior e Código País destinatário difere de 1058 (Brasil) (cPais …).
In English An operation that is not abroad has a receiver country other than Brazil (1058) without idEstrangeiro.
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.
nfe:infNFe
$idDest = '3' or not($cPais) or br:dec($cPais) = 1058 or normalize-space($dest/nfe:idEstrangeiro)
Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol