A tutorial for learning how to customize schemas using the TEI ODD "chain" feature.
What is an ODD Chain
There are two approaches to ODD chains:
1. Inheritance (Vertical Chain)
Uses the source attribute to reference a parent ODD and inherit customizations.
TEI_all โ Base ODD โ Derived ODD โ Further derivations...
2. Combination (Horizontal Chain)
Uses specGrp and specGrpRef to combine multiple ODDs.
Header ODD โโโฌโโโ Combined schema
Body ODD โโโโโ
Directory Structure
tutorials/
โโโ 01-inheritance/ # Inheritance examples
โ โโโ base.odd # Base ODD
โ โโโ derived.odd # Derived ODD inheriting from base.odd
โโโ 02-chain/ # Combination examples
โ โโโ header-specs.odd # Header-related customizations
โ โโโ text-specs.odd # Body text-related customizations
โ โโโ main.odd # Main ODD for integration
โ โโโ merge-specs.xsl # XSLT for expanding specGrpRef
โโโ output/ # Generated files
โ โโโ base.rng # Generated from 01 base ODD
โ โโโ base.html # HTML documentation for the above
โ โโโ derived.rng # Generated from 01 derived ODD
โ โโโ derived.html # HTML documentation for the above
โ โโโ combined.rng # Generated from 02 combined ODD
โ โโโ combined.html # HTML documentation for the above
โ โโโ intermediate/ # Intermediate files
โ โโโ base.compiled.odd
โ โโโ derived.compiled.odd
โ โโโ combined.merged.odd
โ โโโ combined.compiled.odd
โโโ build.sh # Build script
โโโ README.md # This file
Prerequisites
- Saxon (XSLT 2.0 processor)
- TEI Stylesheets (installed at
../scripts/Stylesheets)
Build Instructions
cd tutorials
./build.sh
Generated Files
| Source ODD | RNG | HTML |
|---|---|---|
| 01-inheritance/base.odd | output/base.rng | output/base.html |
| 01-inheritance/derived.odd | output/derived.rng | output/derived.html |
| 02-chain/main.odd (after combination) | output/combined.rng | output/combined.html |
File Descriptions
01-inheritance (Inheritance)
base.odd
The base ODD containing minimal modules and basic customizations.
schemaSpec ident="baseSchema" start="TEI" source="tei:4.7.0">
moduleRef key="tei"/>
moduleRef key="header"/>
moduleRef key="core"/>
moduleRef key="textstructure"/>
schemaSpec>
derived.odd
A derived ODD that inherits from the TEI standard and adds further customizations.
schemaSpec ident="derivedSchema" start="TEI" source="tei:4.7.0">
elementSpec ident="note" mode="delete"/>
elementSpec ident="p" mode="change">
attList>
attDef ident="rend" mode="change">
valList type="closed">
valItem ident="indent"/>
valItem ident="center"/>
valList>
attDef>
attList>
elementSpec>
schemaSpec>
02-chain (Combination)
header-specs.odd
Defines header-related customizations using specGrp.
specGrp xml:id="header-customizations">
elementSpec ident="titleStmt" mode="change">
elementSpec>
specGrp>
text-specs.odd
Defines body text-related customizations using specGrp.
specGrp xml:id="text-customizations">
elementSpec ident="p" mode="change">
elementSpec>
specGrp>
main.odd
Combines multiple ODDs using specGrpRef references.
schemaSpec ident="combinedSchema" start="TEI" source="tei:4.7.0">
moduleRef key="tei"/>
moduleRef key="header"/>
moduleRef key="core"/>
moduleRef key="textstructure"/>
specGrpRef target="header-specs.odd#header-customizations"/>
specGrpRef target="text-specs.odd#text-customizations"/>
schemaSpec>
Processing Flow
Inheritance
base.odd
โ odd2odd.xsl (compile)
intermediate/base.compiled.odd
โโโ odd2relax.xsl โ base.rng
โโโ odd2html.xsl โ base.html
derived.odd (source="tei:4.7.0")
โ odd2odd.xsl (compile + resolve inheritance)
intermediate/derived.compiled.odd
โโโ odd2relax.xsl โ derived.rng
โโโ odd2html.xsl โ derived.html
Combination
header-specs.odd โโ
โ merge-specs.xsl
text-specs.odd โโโโค (expand specGrpRef)
โ
main.odd โโโโโโโโโโ
โ
intermediate/combined.merged.odd
โ odd2odd.xsl
intermediate/combined.compiled.odd
โโโ odd2relax.xsl โ combined.rng
โโโ odd2html.xsl โ combined.html
XSLT Used
| XSLT | Location | Role |
|---|---|---|
| odd2odd.xsl | Stylesheets/odds/ | ODD compilation (module expansion, inheritance resolution) |
| odd2relax.xsl | Stylesheets/odds/ | RelaxNG schema generation |
| odd2html.xsl | Stylesheets/odds/ | HTML documentation generation |
| merge-specs.xsl | 02-chain/ | specGrpRef expansion (custom) |



