The printed linear document is generated by parsing the root html file and including all referenced elements (e.g.: HREF=/path/document#elementName), and the BODY of all referenced documents (e.g. HREF=/path/document), through hyperlinks with the attribute REL="SUBDOCUMENT" or REL="INCLUDE". Thus, the HEAD of the root document is retained, and the HEAD of included documents is discarded. A SUBDOCUMENT file is assumed to be nested within the current section, while an INCLUDE document is at the end of, and at the same level as, the current section. The depths of headers within the referenced document are updated accordingly in the linearized output.
In order to highlight the links to the documents to include, a number of elements are often present, typically an unordered list (UL and LI), which are to be skipped in the linearized document. Such elements are tagged with the attribute CLASS=MD.SKIP; this element and any nested element is skipped, except for referenced documents which may be included. Additionally, the attribute CLASS=MD.SKIPALL is used to skip entirely an element and anything nested.
The HEAD and ABSTRACT sections (DIV elements with CLASS=ABSTRACT, or CLASS=HEAD) of included documents are skipped, leaving only the HEAD and ABSTACT sections of the root document. The appendix sections (within a DIV element with CLASS=APPENDIX) of the root document and of included documents are accumulated, in the order encountered during the linearization, and moved to the end of the BODY section. The header depths of the appendices in included documents are not adjusted, since they are moved to the BODY or the root element. The bibliographic references encountered in the whole document are accumulated and inserted at the end of the document, in a DIV element with CLASS=REFERENCES.
All identifiers (attributes NAME and ID) for elements in merged documents are prepended the document path, to insure unicity within the merged linear document. All hypertext references to merged elements are converted as needed from external references to internal references.