Alternate Versification/Canon Definition Format

From CrossWire Bible Society
Jump to: navigation, search

Canon definition files are found in the sword-tools SVN repository (

Within this repository are a number of different files aimed at generating both canon.h analogues for alternative versification systems and the canon_abbrevs.h file, which defines the abbreviations used by all Sword Bibles.

The files named canon.*.xml define sets of books in various collections. E.g. defines all the books of the Bible (in any versification system). This is the only canon.*.xml file currently being employed in Sword. (Others, such as, canon.nta.xml, and canon.otp.xml, which define Apostolic Fathers, NT apocrypha, & OT pseudepigrapha respectively, may be employed in a future version.)

Header & footer

The canon.*.xml files can be validated with the canon.xsd XML Schema. The format starts with a header:

<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns:xsi="" xsi:noNamespaceSchemaLocation="canon.xsd">

And concludes by closing the collection:


Book definitions

The contents of the <collection> element is a set of book definitions such as the following, for 1 Chronicles. Book definitions are enclosed in a <book> element.

  <abbr mode="westminster">1C</abbr>
  <name>I Chronicles</name>
  <name>1 Chronicles</name>
  <name>I Paralipomenon</name>
  <name>1 Paralipomenon</name>


The first element within the <book> is an <id> element. This contains the unique osisID for the book, used broadly within Sword.


Following the <id> are an arbitrary number (>=0)of <abbr> elements. These values are used in the creation of versification definition files (canon.h analogues). These abbreviations will be recognized when they appear in VPL or IMP files processed by, but they are not used by the Sword API directly. (They do not get copied into canon_abbrevs.h in any way.)

<abbr> elements also accept a mode attribute, as in <abbr mode="westminster">1C</abbr> above. When an abbreviation mode value is specified by the --abbr attribute of, if that mode value equals the mode attribute on the <abbr> element, then the specified abbreviation will override any other mapping for that abbreviation. In the above case, "1C" ordinarily maps to 1 Corinthians. But if is given the argument "--abbr westminster", then "1C" will instead map to 1 Chronicles.


Following the <abbr> definitions are an arbitrary number (>0) of <name> definitions. These values serve three purposes:

  1. As with <abbr>, all <name> values are recognized by as book abbreviations for the purpose of creating canon.h analogues for different versification systems.
  2. All <abbr> values will be used to build the abbreviations found in canon_abbrevs.h.
  3. The first <abbr> value is special, because this value will be used as the English name of the book in Sword.