NFE-388
Rejeição: Código de Situação Tributária do IPI incompatível com o Código de Enquadramento Legal do IPI [nItem: …] (CST …, cEnq …).
In English The IPI CST and legal framework code (cEnq) do not match: exemption 02/52 with 301 to 399, immunity 04/54 with 001 to 099, suspension 05/55 with 101 to 199.
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/nfe:det
(if ($ipiCst = ('02', '52')) then $enq ge 301 and $enq le 399 else true()) and (if ($ipiCst = ('04', '54')) then $enq ge 1 and $enq le 99 else true()) and (if ($ipiCst = ('05', '55')) then $enq ge 101 and $enq le 199 else true())
Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol