# Using the Make Book Function

The MakeBook function is used to assemble large document collections into a single volume.

Amaya enables you to handle document collections. Such a collection may, for example, represent a set of technical documentation made up of several web pages. One of the web pages contains the title of the entire documentation set (an `<h1>` element), an introduction (some other elements), and a list `<ol>` or `<ul>` whose items `<li>` contain links to each chapter. Chapters are separate documents that can have a similar structure.

This organization is useful for browsing, but has several drawbacks when the entire documentation set must be printed. Amaya addresses this problem with the Make book function (XHTML>Make book).

You use typed links for linking chapters, by associating an attribute `rel="chapter"` or `rel="subdocument"` with the anchor that refers to a chapter (to do this, select the `a` element and use the Attributes panel).

Each referred chapter or sub-document can be:

- an external document
- a subset of a larger external document

To refer to a document subset, you usually define a `div` element to identify the part of the target document you want to include, and to link to this target element.

Then, when you activate the Make book function, all blocks (`<li>` elements in the above example) containing a typed link to a chapter will be replaced by the corresponding actual web pages (or web page subsets), and Amaya will display a unique document containing the whole collection:

- If the link refers to a web page, Amaya includes all the `body` content of the target document.
- If the link refers to a target element, Amaya includes this element with its content.
- If the link refers to a target anchor, Amaya includes the content of the anchor, but not the anchor itself.

Before each replacement, the Make book function generates a new `div` element with an `id` attribute to clearly separate each added piece.

Pieces of the new generated document can contain normal links, target anchors, and target elements. During the Make book operation, Amaya ensures that each `name`and `id` attribute value remains unique in the new document. As needed, Amaya changes these values and updates any relative links.

At the same time, Amaya automatically updates external links from referring to an external document or document subset, to referring to the text that is now included. For example, if the link originally pointed to an external document, the link will now refer to the `div`-enclosed element after the Make book operation. This ensures that the new unique document containing the whole collection remains coherent.

This large document can then be numbered and printed with a complete table of contents and a list of all links.