Adding an index to your XML document

DToC is best configured for documents that have indexes.

  1. Open up your XML document.
  2. Open up a new div at the end of your XML file; add a ‘type’ attribute called ‘index’.

  3. Under the <div> tag add a <list> tag.
    DToC expects the index to have a particular structure: list > item > ref. Essentially, what you are creating is an indexed list; the TEI tags mentioned above allow you to structure the list’s hierarchy.
  4. Within the <list> tag add the <item> tag. Each <item> tag wraps around each index entry (its content is the index term).
  5. Add a <ref> tag to the items in the list.
    The <ref> tag has a target attribute, whose value is a space separated list of paragraph XML IDs. The <ref> tag references the paragraph in the body text.

  6. Begin to add your index terms between the item/ref tags. The index contain terms for all the sections (or chapters) of your document.
    The index can be simple or complex depending on your document and/or the effort that you put in to it. For example, the sections below detail how you can cross reference the index or add sub terms within an index theme.
  7. Now note all the paragraph XML ids that the terms are found in. It may be helpful to write this down before you begin creating your index, or you can add the XML ids to your index as you go.
  8. Add the XML ids (from the paragraph(s) or other tags) in the target attribute of the <ref> tag. If there are multiple XML ids related to the index term, separate these with a space.

  9. Save your document.
    Once you have uploaded your document to DToC it will look like this:

The index term “Sherlock” is located in four in the paragraphs of the document.

Record/Note the paragraphs that contain the index term. In this case, the index term is located in the third, fourth, fifth, and sixth paragraphs. These paragraphs are in a small document and have been assigned their own XML ids by the author/creator.

Those paragraphs are assigned “P3”, “P4”, “P5”, and “P6”.

Within the ref tag add the “target” attribute. Then add the paragraph XML ids within the target quotation marks. If there are multiple paragraphs that contain this keyword separate them with a space.