NFE-679
The rule sets below word this rule differently; each wording is shown with its rule set.
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.
Rejeição: Chave de Acesso referenciada com Modelo inválido [nOcor: …] (modelo …).
nfe:infNFe/nfe:ide/nfe:NFref/nfe:refNFe
substring($k, 21, 2) = ('55', '65', '59')
Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol
Rejeição: Chave de Acesso referenciada com Modelo inválido [nOcor: …] (NF-e de saída referencia o modelo …, a partir de …).
nfe:infNFe/nfe:ide/nfe:NFref/nfe:refNFe
not($ide/nfe:tpNF = '1' and not($ide/nfe:finNFe = ('2', '4')) and exists($emitted) and $emitted ge $modelFrom) or not(substring($k, 21, 2) = ('65', '59'))
Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol
Rejeição: Chave de Acesso referenciada com Modelo inválido [nOcor: …] (CT-e modelo …).
nfe:infNFe/nfe:ide/nfe:NFref/nfe:refCTe
substring($k, 21, 2) = '57'
Checked with NF-e 4.00, NF-e 4.00 with authorisation protocol