THL Toolbox > Developers' Zone > Web Development > XML Books > Markup of an XML Book
Contributor(s): Than Grove
There are many mark-up issues involved with XML books. As with all THL XML, the basic markup is defined by our custom TEI DTD, xtib3.dtd. This is explained elsewhere. The process of displaying a book involves a process whereby the XML is transformed into HTML and embedded in an HTML page through AJAX. This complicated process is described in How an XML Book Works. This page is a place to document various markup issues related to XML books in THL.
There are three types of XML books in the THL system, which are in order of their development:
- A collection of essays, e.g. [Studies in Genre|http://www.thlib.org/encyclopedias/literary/genres/genres-book.php#!book=/studies-in-genres/a2/]. This is a book made up of several essays, where each essay is represented by its own XML document,
- A Single Volume Monograph, e.g. [Chöpel's Lhokha Néyik|http://local.thlib.org/places/monasteries/publications/chosphel-book.php#!book=/lho-kha-gnas-yig/wb/a1/] (Don't argue! It's a single volume book, even though THL publishes two other related books by him.)
- A Multi-Volume Works, e.g. the three volumes of the Kham Monastery book (under development).
Each instance of one of these types has a dedicated folder under /cocoon/books/xml/. The three examples given are found at:
- /cocoon/books/xml/kham-monasteries (development only)
|Type||PHP Page URL||Cocoon Pipeline|
Because of the complex interplay between XML, XSLT, HTML, PHP, and JS that is required to display any section of a book on the fly using AJAX, the path to the book needs to be identified in the XML and in the PHP. In the XML this is done through an <idno> tag with type of "bkname" placed in the <publicationStmt> element:
<publicationStmt> <idno type="bkname">lha-sa-gnas-yig</idno> .... </publicationStmt>
In the PHP code, the $add_header variable is modified to contain the cocoon folder name for that book and any volume name. The relevant parts from the Chöpel book are:
While the relevant part from the Literary Genres book is:
Certain things need to be marked up to insure the proper display of the book. Since the Literary Genres book was the first develop, that is in some sense the default style. The other two styles, monograph and multivolume work require some specific markup. Monographs such as the Chöpel book must have a n="wholebook" on the text element, and multivolume works must have rend="book", as follows:
<text lang="tib" rend="tib" n="wholebook">
<text lang="tib" rend="tib book">
To get the Div2s to be numbered sequentially, one has to add the rend="sequential" to each div2. This can be done in Oxygen with a regular expression search '<div2 id="(^"+)">' to be replaced with '<div2 id="$1" rend="sequential">. You can narrow the scope with XPath parameters such as /*//body/div1, or /*//front, etc.