Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

Book Source File Structure

This section describes the book source file structure.

Book Source File Overview

Book source file is the file that contains the contents of the book you are writing. hyPub uses the following rules on the book source file structure.

1. Book source file must be written in XML file format and following XHTML schema rules. This allows you to view your book source files with any Web browsers.

2. Contents in book source files must be organized into containers at 3 different levels:

  • The Index Container - The highest-level container, which is also the default container mapped to the "body" element of the XHTML schema. Index Container requires no declaration.
  • Chapter Containers - The second-level containers, which must be nested inside the Index Container. A chapter container must be declared with as a "blockquote" element.
  • Section Containers - The third-level containers, which must be nested inside a Chapter Container. A section container must be declared with as a "blockquote" element.

Defining a Chapter Container

A chapter container must be declared with as a "blockquote" element as in the following example:

<blockquote class="chapter" id="chapter_name">
(... Contents of the chapter ...)
</blockquote>

where "chapter_name" is the name of the chapter, which must be unique within the same book. The name of a chapter will be used as the Web page name when the book is published on a Web site.

Defining a Section Container

A section container must be declared with as a "blockquote" element as in the following example:

<blockquote class="section" id="section_name">
(... Contents of the section ...)
</blockquote>

where "setion_name" is the name of the section, which must be unique within the same book. The name of a section will be used as the Web page name when the book is published on a Web site.

A Simple Source File Structure Template

Here is a simple template to show you the book source file content structure:

<?xml version="1.0" encoding="UTF-8"?>
<html>
<body>
</body>

... Index level contents ...

<blockquote class="chapter" id="chapter_1">

... Contents for Chapter 1 ...

</blockquote>

<blockquote class="chapter" id="chapter_2">

<blockquote class="section" id="section_2_1">

... Contents for Section 2.1 ...

</blockquote>

<blockquote class="section" id="section_2_2">

... Contents for Section 2.2 ...

</blockquote>

</blockquote>

</html>

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

Writing Book Contents in XHTML Source Files

Book Source File Structure

 Variables Used in Book Source Files

 Inserting Anchors in Book Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

 Controlling Web Page Appearance with CSS

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

 Formatting Printable Documents with XSL-FO

 Generating PDF Documents with hyPub

 Areas of Future Improvements

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
Book Source File Structure