[jats-list] RE: book table of contents

Subject: [jats-list] RE: book table of contents
From: "Daniel S. O'Brien" <dobrien@xxxxxxx>
Date: Fri, 17 Aug 2012 20:56:07 +0000
We use the NLM book DTD for our book production at ACS, including generating
TOCs.  Two further questions will shape your answer.

1.  Is all of your book and chapter content in a single XML file, or is each
chapter in a separate XML file with a parent book XML?
2.  Is your TOC just a repeat of data (chapter title, page number, etc.) that
exists elsewhere in your markup, or are there parts of your TOC (such as
section headings, alternate titles, etc.) that don't exist anywhere else in
your book's XML?


Depending on how you answer the above questions, here are some thoughts:

Choice A)  1 = single XML, 2 = TOC repeats existing data:   Answer could be
simple:  the TOC is not tagged at all, but generated on the fly from existing
chapter <title> and <fpage> tags.

Choice B)  1 = single XML, 2 = TOC has unique data:   add a new <book-part>
with a @book-part-type of something like "toc".  The body of this book part
would be tagged to be your TOC.  Use @xlink:href attribute to provide links
from TOC to the actual chapters.  See example 1 below.

Choice C)  1 = multiple XMLs, 2 = TOC repeats existing data:  tweak the DTD to
add XInclude.  This would allow separate chapter XML files to be linked
together so that they can be processed/parsed as if it were a full text book
XML file -- thus allowing you to either generate a TOC, or link a tagged TOC
to the individual chapters.  In this approach, the root element of the master
book XML would be <book> and the root elements of the child chapter XML files
would be <book-part>; they all share the same book DTD.  In the <body> of the
master book XML, in lieu of actual content, Xinclude tags would link to the
external chapter XML files.    When the book XML is read by an Xinclude-aware
XML parser (many are), then the XML application effectively "sees" the entire
book and chapter content.  This is how ACS handles book production using the
NLM Book DTD:  we edit each chapter individually, then compile the book XML to
perform pagination, followed by TOC generation.   See example 2 below.

Option D)  works with Choices B or C:  If you truly need to tag a TOC (instead
of deriving it from existing data), here's an approach to use a series of
book-part stubs to (re)create the structure of the book -- titles, page
numbers, sequential numbering etc.   If TOC sections are needed, we don't use
<sec> because it doesn't allow for page numbers to be assigned, so instead we
use <book-part> with a @book-part-id="sec".

<!-- Example 1:  tagged TOC -->
<book-part book-part-type="toc">
    <book-part-meta>  <title-group>  <title>Table of contents</title>
</title-group>    </book-part-meta>
    <body>
        <!-- First section; don't use <sec> because it doesn't take page
numbers -->
        <book-part book-part-type="sec" book-part-number="A">
            <book-part-meta>
                <title-group>  <title>First Section</title> </title-group>
                <fpage>1</fpage>
            </book-part-meta>
            <body>
                <!-- The xlink:href points to the ID of the actual chapter
book-part to provide linking -->
                <book-part xlink:href="#chapter1.xml-ch1"
book-part-number="1"><book-part-meta>
                     <title-group><title>Chapter 1</title></title-group>
                     <fpage>3</fpage>
                </book-part-meta></book-part>
                <book-part xlink:href="#chapter2.xml-ch2"
book-part-number="2"><book-part-meta>
                    <title-group><title>Chapter 2</title></title-group>
                    <fpage>29</fpage>
                </book-part-meta></book-part>
                <book-part xlink:href="#chapter3.xml-ch3"
book-part-number="3"><book-part-meta>
                    <title-group><title>Chapter 3</title></title-group>
                    <fpage>47</fpage>
                </book-part-meta></book-part>
            </body>
        </book-part>

        <!-- Second section  -->
        <book-part book-part-type="sec" book-part-number="B">
            <book-part-meta>
                <title-group>  <title>Second Section</title> </title-group>
                <fpage>73</fpage>
            </book-part-meta>
            <body>
                <book-part xlink:href="#chapter4.xml-ch4"
book-part-number="4"><book-part-meta>
                    <title-group><title>Chapter 4</title></title-group>
                    <fpage>75</fpage>
                </book-part-meta></book-part>
                <book-part xlink:href="#chapter5.xml-ch5"
book-part-number="5"><book-part-meta>
                    <title-group><title>Chapter 5</title></title-group>
                    <fpage>97</fpage>
                </book-part-meta></book-part>
                <book-part xlink:href="#chapter6.xml-ch6"
book-part-number="6"><book-part-meta>
                    <title-group><title>Chapter 6</title></title-group>
                    <fpage>123</fpage>
                </book-part-meta></book-part>
            </body>
        </book-part>

        <!-- ... -->
</book-part>


<!-- Example 2:  XInclude:  master book.xml -->
<book>
  <book-front .../>
  <body>
     <book-part book-part-type="toc">
         <book-part-meta>  <title-group>  <title>Table of contents</title>
</title-group>    </book-part-meta>
         <body>
                <!-- TOC content goes here, if it cant be dynamically
generated -->
         </body>
     </book-part>
     <xi:include href="chapter1.xml"/>   <!-- with a root element of
<book-part>... -->
     <xi:include href="chapter2.xml"/>   <!-- with a root element of
<book-part>... -->
     <xi:include href="chapter3.xml"/>   <!-- with a root element of
<book-part>... -->
  </body>
</book>

Apart from the minor effort of adding XInclude to the DTD, the only other
consideration of the XInclude approach is that any ID values would to be
unique across the entire book.  I.e., an ID of "fig1" chapter1.xml would
conflict with ID of "fig1" in chapter3.xml when processing the linked book.
The IDs can be made unique by prepending the filename to them and any matching
IDREFs - this process could be automated.

I hope this gives you some possible direction.  Also interested in hearing if
others have alternate approaches.


Dan O'Brien
Publishing Production Systems
American Chemical Society
dobrien@xxxxxxx
"Improving people's lives through the transforming power of chemistry"


-----Original Message-----
From: Cindy Maisannes [mailto:Cindy.Maisannes@xxxxxxxxxxxxxxxx]
Sent: Thu, August 16, 2012 5:34 PM
To: jats-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [jats-list] book table of contents

Hello,

We are using the NLM book 3.0 dtd to tag book content, and need to create an
XML-tagged table of contents for each book. Are there examples of how others
have tagged TOCs using the book tagset?  I'd appreciate any suggestions from
anyone else who has had to tackle this.

Thanks!
Cindy

Current Thread