Numbered and unnumbered div

div

The TEI provides two different kinds of div element: a numbered form in which the numbering indicates the level within the hierarchy (div1, div2, div3, etc.), and an unnumbered form in which the simple div element nests recursively within itself. There are arguments for and against both methods.

One reason for using numbered divN is that it assists encoders in keeping track of the hierarchies of the document. It is easier to see at a glance that your div3 lacks an end-tag than it is to tell which of your unnumbered div elements is still open. However, good encoder training and encoding strategies for long documents (e.g. always insert whole elements with end-tags rather than inserting only a start-tag) and a good text editor can make this assistance unnecessary. The XML-aware editors now available can show the document hierarchy and reveal missing tags, and in general provide the support an encoder needs in order to keep track of his/her location in the document hierarchy.

Another reason for using numbered divN is that in some cases it may simplify processing of the finished file, for instance by allowing a stylesheet to perform the same formatting or transformations on all of the divN elements at a specified level. This is likely to be true if all divisions at a given level behave the same way stylistically: for instance, if all div4s are the same kind of text chunk (a chapter, a poem). However, if you are encoding a set of texts whose structure varies, there may be no commonality between the divisions at a given level (div3 in one text may be a poem while div3 in another may be an essay, or the poems in one text may be nested one level deeper than in another). In these cases, basing the processing on the specific divN level would not work. In fact, stylesheets are able to keep track of divN levels without relying on div numbering, so although it may be easier to write a stylesheet that uses divN numbering as a guide, the use of numbered divN is certainly not essential to this purpose.

One advantage of unnumbered div is that it allows for unlimited nesting of divisions, whereas with numbered divN you are restricted to seven levels of nesting. This restriction will not be a problem with simple texts, but with complex nested narratives or documents with a great deal of interior subgrouping, the limit might pose difficulties. Using unnumbered div also allows greater flexibility in altering the div structure of the document after it has been encoded: for instance, if you decide that several poems actually consitute a group whose identity should be represented, inserting a numbered divN would require renumbering the existing divN structure, whereas inserting an unnumbered div can be done without fuss.

The TEI community includes substantial numbers of projects that use each method, so both are well attested and neither can be dismissed out of hand. This Guide recommends the use of unnumbered div because in our experience the advantages of using numbered divN do not gain us much, and we find the flexibility of unnumbered div important for the kinds of complex texts whose encoding we are most concerned to document. However, if any of the advantages of numbered divN apply to you, it is easy to convert from one approach to the other using an XSLT stylesheet.