odd_relax¶
Write the RELAX NG schema for a compiled ODD (the result of
compiled_odd), as the TEI Stylesheets' odd2relax does:
opm odd compile --format rng.
opm.odd_relax ¶
Translate a compiled ODD into RELAX NG, as the TEI Stylesheets' odd2relax does.
Expects the output of compiled_odd: one
schemaSpec with every selected spec already merged (no moduleRef,
@source, or @mode left to resolve). The translation follows what the
TEI Stylesheets do in
odds/odd2relax.xsl, odds/teiodds.xsl and odds/classatts.xsl.
- Names. Each element, macro or class becomes a
definenamed from its ident, with the spec's@prefixor theschemaSpec's. A model class is achoiceof its members (notAllowedif empty). An attribute class becomes<class>.attributes, with parent-class refs and one<class>.attribute.<ident>per attribute. - Attributes. An element refs its classes'
.attributespatterns. If itsattListoverrides a class attribute, that class is expanded attribute by attribute and the override is merged in. - Content. ODD content maps to RELAX NG:
sequence→group(orlistwhen it holds onlydataRef),alternate→choice,@minOccurs/@maxOccurs→ repetition patterns,classRef/@expand→ the class members,anyElement→ its own pattern. Datatypes are written inline; embedded RELAX NG incontentis copied through. - Clean-up. Refs to specs the schema omits are dropped, along with empty patterns and unreachable definitions.
Does not embed Schematron (constraintSpec), and skips Guidelines chapters
cited by listRef.