Appearance
LEI Taxonomy Example
This is an analysis of the Legal Entity Identifier (LEI) taxonomy, staged in this vault as raw source material under docs/Sources/xbrl/lei-taxonomy-REC-2020-07-02/ (open it in an XBRL processor such as Arelle to follow along). It's a simple, real-world example of how XBRL taxonomies work.
What Is an LEI?
A Legal Entity Identifier is a 20-character alphanumeric code (ISO 17442) that uniquely identifies legal entities participating in financial transactions. Format: [0-9A-Z]{18}[0-9]{2} (18 alphanumeric + 2 check digits).
Package Structure
This is a taxonomy package:
lei-taxonomy-REC-2020-07-02/
├── META-INF/
│ ├── taxonomyPackage.xml ← Package manifest
│ └── catalog.xml ← URL remapping
├── lei.xsd ← Main schema (entry point 1)
├── lei-required.xsd ← Required LEI schema (entry point 2)
├── lei-formula-functions.xsd ← Formula functions (entry point 3)
├── lei-label.xml ← Label linkbase
├── lei-formula.xml ← Formula linkbase (validation rules)
├── lei-required-formula.xml ← Additional formula rules
└── lei-formula-functions.xml ← Custom XPath functionsThe Schema (lei.xsd)
Defines one concept: LEI
xml
<xsd:element name="LEI"
id="lei_LEI"
substitutionGroup="xbrli:item"
nillable="true"
xbrli:periodType="duration"
type="lei:leiItemType" />And a custom data type with validation:
xml
<xsd:complexType name="leiItemType">
<xsd:restriction base="xbrli:stringItemType">
<xsd:pattern value="[0-9A-Z]{18}[0-9]{2}"/>
<xsd:length value="20"/>
</xsd:restriction>
</xsd:complexType>This enforces that any reported LEI must be exactly 20 characters matching the pattern.
Also defines a domain element (LEIDomain) and a simple type (leiType) for use in dimensional contexts.
The Label Linkbase (lei-label.xml)
Provides two labels for the LEI concept:
- Standard label: "Legal Entity Identifier"
- Documentation label: "Legal Entity Identifier (LEI) for the reporting entity."
This is a minimal example of a label linkbase.
The Formula Linkbase (lei-formula.xml)
Contains five formula assertions -- a rich example of validation:
| Assertion | What It Validates |
|---|---|
lei-fact-checksum | LEI fact values have valid checksums |
lei-fact-checksum-digits | Check digits are not 00, 01, or 99 |
lei-identifier-checksum | Entity identifier LEIs have valid checksums |
lei-identifier-checksum-digits | Entity identifier check digits are valid |
lei-identifier-format | Entity identifier LEIs have correct format |
Each assertion uses:
- Variable filters to select relevant facts (by data type or entity scheme)
- Custom functions (
lei-fn:validate-checksum,lei-fn:validate-format) - Error messages with dynamic content:
"The value '{ $v }' is not a valid Legal Entity Identifier (invalid checksum)"
The Three Entry Points
From the taxonomyPackage.xml:
- Legal Entity Identifier (
lei.xsd) -- the standard concept and validation - Legal Entity Identifier (required primary identifier) (
lei-required.xsd) -- enforces that ALL facts use an LEI as the entity identifier - LEI formula functions (
lei-formula-functions.xsd) -- just the validation functions for reuse
What This Example Teaches
- Simple taxonomy structure: one concept, one schema, a few linkbases
- Custom data types: how to restrict values with patterns and lengths
- Formula validation: real-world checksum validation beyond simple arithmetic
- Multiple entry points: different levels of enforcement from the same taxonomy
- Package structure: how META-INF, schemas, and linkbases are organised