Section 7.3 Versions of the Schema
The schema is born within a PreTeXt document,
schema/pretext.xml, where surrounding text provides documentation and guidance on implementation. The literate programming support in PreTeXt (start at Section 4.30) is used to produce a file,
schema/pretext.rnc, which is a RELAX-NG specification in compact syntax. HTML and PDF versions are available on the PreTeXt website as documentation. We provide some guidance below on reading the compact syntax.
The compact syntax is a faithful representation of the more verbose XML syntax. And vice-versa, so it is possible to translate back-and-forth between the two syntaxes. In practice, we convert the compact version to the XML version, producing a file
schema/pretext.rng. Some tools require this latter (100% equivalent) version. We perform this conversion with
trang, an open source program written by James Clark, one of the authors of RELAX-NG. (
trangstands for “TRAnslator for relax NG”.) The compact syntax is often indicated as RNC and the XML syntax is often indicated as RNG.
XSD (XML Schema Definition), from the World Wide Web Consortium (W3C), is an alternative to the RELAX-NG syntax. It cannot express as many situations as the RELAX-NG syntax, but we have created the PreTeXt schema in a way that
trangcan convert to an XSD specification without introducing any more-permissive “approximations.” But the XSD version seems to have a few small inaccuracies, and in particular should not be used for validation. That said,
schema/pretext.xsdmay be useful for tools (e.g. editors) that require it.
pretext.xsdare all provided in the
schemadirectory under revision control, and are updated by the
schema/build.shscript when changes are made to
pretext.xml. So as an author, you do not need to install or run
trangand should just link to the (continually updated) copies in your
We once provided a document type definition (DTD) as a description of the PreTeXt vocabulary. Mitch Keller 1 wrote an excellent initial version of this chapter to help others understand similar principles in the context of the DTD. However, the DTD was not sufficiently flexible to handle elements that behave differently in different locations, such as an
<exercisegroup>. As further evidence,
trangwill knowingly refuse to convert the PreTeXt schema to a DTD since the DTD syntax is not sufficiently expressive to describe PreTeXt.