Table of contents

Abstract

Considerations in creating multiple page sequences

XML document structure and fo:page-sequences

The default XSL:FO approach

The XSL:FO solution

The default implementation in the DITA Open Toolkit: single page sequence

The solution in the DITA Open Toolkit: multiple page sequences

Conclusion

About the author

XML document structure and fo:page-sequences

In an XML document, you might have a structure similar to Example 1.

Example 1

<book>

   <section>

   <body>...</body>

     <section>

       <body> </body>

     </section>

   </section>

</book>

Now imagine that the second-level sections contain hundreds of additional sections, many embedded in each other, and the document is 10,000 pages long.

The FO output for the body of the example document is similar to Example 2:

Example 2

<fo:page-sequence>

   <fo:flow>

     <fo:block> <!-- book -->

       <fo:block> <!-- section -->

         <fo:block> <!-- section body-->

         </fo:block>

         <fo:block> <!-- child section -->

           <fo:block> <!-- child section body -->

           </fo:block>

         </fo:block>

       </fo:block>

     </fo:block>

   </fo:flow>

</fo:page-sequence>

To break the document into multiple page sequences down to the second-level section, the output would resemble Example 3:

Example 3

<fo:page-sequence>

   <fo:flow>

     <fo:block> <!-- section -->

       <fo: block> <!-- section body -->

       </fo:block>

     </fo:block>

   </fo:flow>

</fo:page-sequence>

<fo:page-sequence>

   <fo:flow>

     <fo:block> <!-- child section-->

       <fo: block> <!-- child section body -->

       </fo:block>

     </fo:block>

   </fo:flow>

</fo:page-sequence>

The block for the child section is at the same level as the block for the section, but it is in a separate page sequence. Formatting and numbering are based on the XML tree in the source document and not the output document, so they are preserved.

The FO output has been flattened into a sequence of fo:page-sequence elements. Applying this pattern to the 10,000 page document would give you hundreds or thousands of fo:page-sequence elements—and no Java memory problems.

 

Next Page:
The default XSL:FO approach


Scriptorium Publishing | Post Office Box 12761 Research Triangle Park, NC 27709 | (919) 481 2701 | info@scriptorium.com