Selecting Tables of Contents Using Field Values

In the interests of achieving the most unified design possible for the tables of contents used in your system and to simplify the work for editorial staff it is recommended that you write the code for various tables of contents in a layout in advance and that you select which table of contents to use in a folder by using a custom field. To do this proceed as follows:

  1. Create a field for selecting the type of the table of contents to be inserted (see The Fields Section). Properties of this field:
    Type: Enumeration
    Name e.g.: TocListType
    Selection values, e.g.: list, series of paragraphs, table ...

  2. In the topmost folder level create a layout with a name such as list that contains the code for all tables of contents. Every table of contents is enclosed by a condition that queries the value of the field TocListType. An example:

    <npsobj condition="isEqual" name1="TocListType" value2="ParagraphOrder">
      <npsobj list="toclist">
      <p>
        <npsobj name="self" insertvalue="anchor">
          <npsobj name="title" insertvalue="var"/>
        </npsobj>
      </p>
      </npsobj>
    </npsobj>
  3. Supplement all file formats for which the file type folder has been set with the TocListType field and this predefined main content:
    <npsobj insertvalue="template" name="list"/>"

These measures will insert the list layout as the default content in every folder. The editors must then simply determine which of the predetermined formats and contents is to be used for the table of contents in the folder by selecting a value for the field TocListType. The predetermined main content of every folder can of course be changed as required.

This mechanism has the desirable side effect that all changes to the layout of tables of contents can be made globally by changing the code in the layout. This does away with time-consuming editing of every individual folder.