# BR-DE-22

Source: https://xmlvalid.com/rules/BR-DE-22

> Das "filename"-Attribut aller "EmbeddedDocumentBinaryObject"-Elemente muss eindeutig sein

- Level: error
- Rule sets: XRechnung 3.0 rules (UBL) 2.6.0
- Context: `/ubl:Invoice | /cn:CreditNote`
- Test: `count(cac:AdditionalDocumentReference) = count(cac:AdditionalDocumentReference[not(./cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename = preceding-sibling::cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject/@filename)])`

> Not all filename attributes of the embeddedDocumentBinaryObject elements are unique

- Level: error
- Rule sets: XRechnung 3.0 rules (CII) 2.6.0
- Context: `/rsm:CrossIndustryInvoice`
- Test: `count(//ram:AdditionalReferencedDocument) = count(//ram:AdditionalReferencedDocument[not(./ram:AttachmentBinaryObject/@filename = preceding-sibling::ram:AdditionalReferencedDocument/ram:AttachmentBinaryObject/@filename)])`

## Why it fails

- Two attachments (`cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject`) have the same `filename`, often `attachment.pdf` from a generator that names every file alike.

## How to fix it

- Give each embedded file a name of its own, such as `timesheet-2026-09.pdf` and `delivery-note-4711.pdf`.

Validate a document against these rules: https://xmlvalid.com/validate
