Flow Object Class Reference

Revision 1

May 10, 1998

This software is copyrighted by its respective authors. The following terms apply to all files associated with the software unless explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. Modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated on the first page of each file where they apply.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.


Table of Contents
Introduction
Organization
Key to Tables of Characteristics
Where to Get It
Contributing
simple-page-sequence
Reference
Characteristics
Associated Functions
Tutorial
Sample SGML File
Defaulting All Characteristics
Setting Page Size Only
Setting Margins
Adding a Footer
Reusing the Title in the Header
Reusable Sosofos
Different Header on First Page
Different Recto and Verso Headers and Footers
Page Procedure

Introduction

Welcome to the start of what could be a very good reference to DSSSL's flow object classes. It is a humble beginning, but with time, and contributions, it will become a valuable resource to people using DSSSL and to people using the DSSSL flow objects with XSL.

This material is, or will be, part of the DSSSL Handbook (http://www.mulberrytech.com/dsssl/dsssldoc/handbook.html), which itself is a product of the DSSSL Documentation Project, a collaborative effort by users of DSSSL to write and disseminate documentation on all aspects of DSSSL for the purposes of introducing DSSSL to new users, education for both new and experienced users, and assistance for people using DSSSL.

The project draws on the combined experience of present users of DSSSL, principally those subscribed to the DSSSList mailing list (http://www.mulberrytech.com/dsssl/dssslist/), which also hosts the discussion between project participants.


Organization

This book currently describes a single flow object class, simple-page-sequence, but the next revision will have more.

The material is divided into reference and tutorial sections.

The reference section discusses the flow object and lists all of its characteristics, both those defined in the DSSSL standard and additional characteristics implemented in particular DSSSL engines or backends. Following the style of the dsssl-o specification, the standard characteristics and their values, defaults, and required support in dsssl-o are listed in a quick-reference table, which is followed by additional information about the characteristics. The non-standard characteristics follow a similar format, except that the dsssl-o column is unnecessary for them.


Key to Tables of Characteristics

The table columns are:


Where to Get It

This material is available in SGML, HTML, and RTF from under the DSSSL Documentation Project page at http://www.mulberrytech.com/dsssl/dsssldoc/.

The original SGML document is marked up in accordance with the DocBook 3.0 DTD, and SGML original is processed using Jade (http://www.jclark.com/jade/) and the Modular DocBook Stylesheet (http://nwalsh.com/) to produce the HTML and RTF forms.


Contributing

Contributions to this document, to the DSSSL Handbook, and to other DSSSL Documentation Project material is actively solicited. If you would like to contribute, please contact B. Tommie Usdin ([email protected]).


simple-page-sequence

The simple-page-sequence flow object is the most basic page model flow object in DSSSL's repertoire of flow objects. It also happens to be the only one currently implemented in Jade, the most popular DSSSL engine.


Reference

A simple-page-sequence flow object class is formatted to produce a series of page areas. A simple-page-sequence flow object may accept any displayed flow object, but a simple-page-sequence is not allowed within any other flow object class.

It may have a single-line header and a single-line footer. The standard states that header and footer text must be constant except for a page number, which can be formatted from the page-number-sosofo procedure defined in the standard. Since the header and footer characteristics are actually specified as inline sosofos, it is possible, for example, to specify an inline external-graphic in the header or footer.

Jade supports some additional procedures that allow different header and footer content between recto and verso pages and on the first page formatted from a simple-page-sequence, as well as additional characteristics that control the appearance of the formatted page number.

A document can contain multiple simple-page-sequences. For example, each chapter can be a separate simple-page-sequence, with different header and footer text, which could include the current chapter title.

The header and footer lines are divided into three parts: left, center, and right. The standard does not state how the header or footer line is divided into these three parts, or what happens if a formatted sosofo overflows the area notionally available for it. For example, Jade's RTF backend positions the formatted header and footer sosofos at tab stops in the header and footer lines, but if the contents of the left header takes more than half the line, the contents of the center header is pushed to the next tab stop and the contents of the right header is, well, lost off the edge of the page. Other DSSSL engines or other backends may format the same sosofos differently in this situation.

The header and footer margins measure from the top and bottom of the page, respectively, to the placement path (effectively the baseline) of the header and footer text, respectively. It is not the case that the header margin measures to the top of the header text, and the footer margin, to the bottom of the footer text.

Page areas formatted from a simple-page-sequence fill from top to bottom. Although simple-page-sequence has a writing-mode characteristic, the standard states that this applies only to the writing-mode of the header and footer lines.


Characteristics

The following table lists information about each of the characteristics of the simple-page-sequence flow object class.

CharacteristicInh.Standard ValuesStandard Init/Defaultdsssl-o
bottom-marginIlength0ptStandard
center-footerNunlabeled sosofoempty sosofoStandard
center-headerNunlabeled sosofoempty sosofoStandard
footer-marginIlength0ptStandard
header-marginIlength0ptStandard
left-footerNunlabeled sosofoempty sosofoStandard
left-headerNunlabeled sosofoempty sosofoStandard
left-marginIlength0ptStandard
page-heightIlengthsystem-dependentStandard
page-widthIlengthsystem-dependentStandard
right-footerNunlabeled sosofoempty sosofoStandard
right-headerNunlabeled sosofoempty sosofoStandard
right-marginIlength0ptStandard
top-marginIlength0ptStandard
writing-modeIleft-to-right, right-to-left, top-to-bottomleft-to-rightDefault


Jade-Specific Characteristics

Jade 1.1 supports five additional characteristics of the simple-page-sequence flow object class:

CharacteristicInh.ValuesInit/Default
page-number-formatIString1
page-number-restart?I#t, #f#f
page-n-columnsIInteger greater than 01
page-column-sepIlength0.5in
page-balance-columns?I#t, #f#f


Associated Functions

The DSSSL standard defines two functions associated with simple-page-sequence:


Jade-Specific Functions

Jade 1.1 supports two external procedures providing additional control over headers and footers in simple-page-sequence flow objects:


Tutorial

Through numerous examples you'll see how to use each of the characteristics of simple-page-sequence, including a few examples of what not to do.


Sample SGML File

All of the examples use the same SGML document, sample.sgm, shown below. The structure is very simple: a book containing a title and two paragraphs.

<!DOCTYPE book [
<!ELEMENT book          - - (title, para*)                           >
<!ELEMENT title         - - (#PCDATA)                                >
<!ELEMENT para          - - (#PCDATA)                                >
]>
<book><title>Title</title>
<para>This is a paragraph.</para>
<para>This is a somewhat longer paragraph just so we can be sure that
this paragraph is going to wrap onto another line and maybe another
page when we produce formatted output.</para>
</book>

Defaulting All Characteristics

The stylesheet default.dsl contains one element construction rule, and it just uses simple-page-sequence without declaring any values for the characteristics:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

;; BOOK element
(element BOOK
   (make simple-page-sequence))

The defaults for page-height and page-width are system-dependent and the defaults for all of the margins is 0pt. The result, when using Jade's RTF backend and viewing in Microsoft Word, is that the page height and width are Word's default, the text fills from one edge of the page to the other, and there is a minimal top margin:


Setting Page Size Only

pagesize.dsl includes values for page-height and page-width and declares styles for the title and para elements:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The results are more reproducible, since we're not using the system-dependent defaults, but the margins are still 0pt and the text flows from one edge of the page to the other:


Setting Margins

margins.dsl adds declarations for the top-margin, bottom-margin, left-margin, and right-margin characteristics:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi
         left-margin: 1pi
         right-margin: 2pi
         top-margin: 3pi
         bottom-margin: 4pi))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The margins are each a different size so you can clearly see the effect of each characteristic:

Note that you can set Word's ruler to show measurements in picas from the �General� tab of the �Options� dialog box opened from the �Options...� item in the �Tools� menu.


Adding a Footer

footer.dsl sets the top and bottom margins to 4 pica, the header margin to 3 pica, and the footer margin to 1 pica. It also defines a style which will be used in the footer. A sosofo named footer-page-number is defined within the element construction rule for the BOOK element, and that sosofo is used as the value of the right-footer characteristic:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

;; BOOK element
(element BOOK
   (let ((footer-page-number
    (make sequence
          use: footer-style
          (literal "Page ")
          (page-number-sosofo))))
     (make simple-page-sequence
     page-width: 15pi
     page-height: 20pi
     left-margin: 2pi
     right-margin: 2pi
     top-margin: 4pi
     bottom-margin: 4pi
     header-margin: 3pi
     footer-margin: 1pi
     right-footer: footer-page-number)))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The footer text appears at the bottom right of each page, and the baseline of the text is 1 pica from the bottom of the page. Since we used the page-number-sosofo function defined in the DSSSL standard, we show a page number that increments for each page:


Reusing the Title in the Header

header.dsl adds a header-title sosofo, used in the right header, that is the result of processing the book's title:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

(mode header-title
      (element TITLE
         (process-children)))

;; BOOK element
(element BOOK
   (let ((header-title
    (make sequence
          use: footer-style
          (with-mode header-title
         (process-matching-children "TITLE"))))
         (footer-page-number
    (make sequence
          use: footer-style
          (literal "Page ")
          (page-number-sosofo))))
     (make simple-page-sequence
     page-width: 15pi
     page-height: 20pi
     left-margin: 2pi
     right-margin: 2pi
     top-margin: 4pi
     bottom-margin: 4pi
     header-margin: 3pi
     footer-margin: 1pi
     right-footer: footer-page-number
     right-header: header-title)))

(element TITLE
   ($para$))

(element PARA
   ($para$))

As well as using the footer-style style, the header-title sosofo uses the header-title mode when processing the title. Without using the mode, the title would be processed in the default mode and appear as 12 point Arial text (and the paragraph flow object in the default mode's TITLE element construction rule would create problems since the header and footer should contain only in-line flow objects).


Reusable Sosofos

Up until now, the header and footer sosofos have been declared within the scope of a single element construction rule. This works fine when there is only one page sequence for the whole document, but it is common for complex documents to have different different headers and footers for different parts; for example, no header or footer for the title page, a different page numbering style for the Table of Contents and introductory matter, or a different style for appendices or back matter such as an index. You can �reuse� header and footer sosofos by declaring procedures for them outside of the scope of any element construction rules.

procedure.dsl is the same as header.dsl except that the header-title and footer-page-number sosofos are now implemented as procedures, and the references to them are now procedure references:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

(define (header-title)
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-matching-children "TITLE"))))

(define (footer-page-number)
  (make sequence
  use: footer-style
  (literal "Page ")
  (page-number-sosofo)))

(mode header-title
      (element TITLE
         (process-children)))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi
         left-margin: 2pi
         right-margin: 2pi
         top-margin: 4pi
         bottom-margin: 4pi
         header-margin: 3pi
         footer-margin: 1pi
         right-footer: (footer-page-number)
         right-header: (header-title)))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The output, not surprisingly, is exactly the same as that produced with header.dsl, except that if we had multiple uses for a simple-page-sequence flow object, we could reuse these procedures without having to redeclare them.


What not to do

variable.dsl is similar to procedure.dsl, except that the header-title and footer-page-number are implemented as top-level variables, not as procedures:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

(define header-title
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-matching-children "TITLE"))))

(define footer-page-number
  (make sequence
  use: footer-style
  (literal "Page ")
  (page-number-sosofo)))

(mode header-title
      (element TITLE
         (process-children)))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi
         left-margin: 2pi
         right-margin: 2pi
         top-margin: 4pi
         bottom-margin: 4pi
         header-margin: 3pi
         footer-margin: 1pi
         right-footer: footer-page-number
         right-header: header-title))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The definition of header-title, however, fails with the following error message:
jade:variable.dsl:24:5:E: attempt to use current node when there is none
because, as a variable, header-title is being defined in a context outside of any element construction rules, and there is no �current node� to have children to process.


Different Header on First Page

The Jade-specific if-first-page procedure can be applied to any of the header or footer characteristics.

first-page.dsl adds the declaration for the if-first-page procedure, and uses it to control the appearance of the header-title sosofo:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define if-first-page
  (external-procedure "UNREGISTERED::James Clark//Procedure::if-first-page"))

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

(define (header-title)
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-matching-children "TITLE"))))

(define (footer-page-number)
  (make sequence
  use: footer-style
  (literal "Page ")
  (page-number-sosofo)))

(mode header-title
      (element TITLE
         (process-children)))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi
         left-margin: 2pi
         right-margin: 2pi
         top-margin: 4pi
         bottom-margin: 4pi
         header-margin: 3pi
         footer-margin: 1pi
         right-footer: (footer-page-number)
         right-header: (if-first-page
            (empty-sosofo)
            (header-title))))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The header title does not appear on the first page:


Different Recto and Verso Headers and Footers

The Jade-specific if-front-page procedure lets you use different header and footer sosofos on the front/right-hand/recto page and on the back/left-hand/verso page.

Using if-front-page, front-page.dsl swaps the placement of the header-title and footer-page-number sosofos between the recto and verso pages so they are always on the outside (furthest from the spine) edge of the page:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(define if-first-page
  (external-procedure "UNREGISTERED::James Clark//Procedure::if-first-page"))

(define if-front-page
  (external-procedure "UNREGISTERED::James Clark//Procedure::if-front-page"))

(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

(define (header-title)
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-matching-children "TITLE"))))

(define (footer-page-number)
  (make sequence
  use: footer-style
  (literal "Page ")
  (page-number-sosofo)))

(mode header-title
      (element TITLE
         (process-children)))

;; BOOK element
(element BOOK
   (make simple-page-sequence
         page-width: 15pi
         page-height: 20pi
         left-margin: 2pi
         right-margin: 2pi
         top-margin: 4pi
         bottom-margin: 4pi
         header-margin: 3pi
         footer-margin: 1pi
         right-footer: (if-front-page
            (footer-page-number)
            (empty-sosofo))
         left-footer: (if-front-page
           (empty-sosofo)
           (footer-page-number))
         right-header: (if-first-page
            (empty-sosofo)
            (if-front-page
             (header-title)
             (empty-sosofo)))
         left-header: (if-first-page
           (empty-sosofo)
           (if-front-page
            (empty-sosofo)
            (header-title)))))

(element TITLE
   ($para$))

(element PARA
   ($para$))

The page number appears in the right footer on recto (right-hand) pages and in the left footer on verso (left-hand pages), and, on pages other than the first, the book title similarly alternates between the right and left headers:


Page Procedure

page.dsl separates the simple-page-sequence into a procedure called from the BOOK element construction rule. The generic-page-sequence procedure uses the keyword form of procedure declaration so that the parameters may be specified in any order in a procedure call (or omitted, since every parameter has a default). Note that this does not create a new generic-page-sequence flow object class�the procedure call merely resembles the specification of a flow object class.

<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 1. External procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define if-first-page
  (external-procedure "UNREGISTERED::James Clark//Procedure::if-first-page"))

(define if-front-page
  (external-procedure "UNREGISTERED::James Clark//Procedure::if-front-page"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 2. Unit definitions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-unit pi (/ 1in 6))
(define-unit pt (/ 1in 72))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 3. Page dimensions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; These setup the page size and other parameters

;; Horizontal dimension
(define %page-width% 15pi)
;; Vertical dimension
(define %page-height% 20pi)
;; Left margin
(define %left-margin% 2pi)
;; Right Margin
(define %right-margin% 2pi)
;; Space from top of page to top of body text
(define %top-margin% 4pi)
;; Space from bottom of page to bottom of body text
(define %bottom-margin% 4pi)
;; Space from top of page to top of header.  Should be less than %top-margin%
(define %header-margin% 3pi)
;; Space from bottom of page to bottom of footer.  Should be less than
;; %bottom-margin%
(define %footer-margin% 1pi)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 4. Common procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define ($para$)
  (make paragraph
  quadding: 'justify
  font-size: 12pt
  font-family-name: "Arial"
  space-before: 12pt
  space-after: 12pt))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 5. Styles
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define footer-style
  (style
   font-size: 9pt
   font-family-name: "Arial"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 6. Header and Footer procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; These procedures may be referenced as parameters to the
;; generic-page-sequence procedure that we are using to setup our
;; page.

;; footer-page-number
;; Just the page number
(define (footer-page-number)
  (make sequence
  use: footer-style
  (page-number-sosofo)))

;; verbose-footer-page-number
;; Page number in "Page nnn" format
(define (verbose-footer-page-number)
  (make sequence
  use: footer-style
  (literal "Page ")
  (page-number-sosofo)))

;; chapter-number-page-number
;; Include the chapter number in the page number, e.g. "1-1"
(define (chapter-number-page-number)
  (make sequence
  use: footer-style
  (literal
   (string-append
    (number->string
     (child-number))
    "\en-dash"))
  (page-number-sosofo)))

;; book-title
;; The book title
(define (book-title)
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-node-list
        (select-elements
         (children
          (ancestor "BOOK"))
         "TITLE")))))

;; my-title
;; Just the title of the current element
(define (my-title)
  (make sequence
  use: footer-style
  (with-mode header-title
       (process-matching-children "TITLE"))))

;; chapter-number-title
;; The chapter number plus the chapter title
(define (chapter-number-title)
  (make sequence
  use: footer-style
  (literal
   (string-append
    "Chapter "
    (number->string
     (child-number))
    ": "))
  (with-mode header-title
       (process-matching-children "TITLE"))))

;; graphic
;; Just a graphic, just to prove we can
(define (graphic)
  (make external-graphic
  entity-system-id: "image1.gif"
  display?: #f))

;; Used when getting titles for use in headers
(mode header-title
      ;; Hierarchy Name: TITLE
      ;;
      ;; This could be the title of the book or of a chapter
      (element TITLE
         (process-children)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 7. "generic-page-sequence" procedure definition
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is the procedure we are using to make our simple-page-sequence
;; flow objects.  All of the element construction rules that want to
;; change the header or footer use this procedure and supply zero or
;; more of the pre-defined header and footer procedures for the
;; appropriate slots in the header and footer.  If any slots aren't
;; filled, they default to (empty-sosofo).
;;
;; The advantage of this over using a simple-page-sequence in each of
;; those element construction rules is that we only do it once, and
;; this procedure takes care of swapping left and right on recto and
;; verso pages and suppressing headings on the first page of the
;; simeple-page-sequence.
(define (generic-page-sequence
   #!key
   (inside-header (empty-sosofo))
   (center-header (empty-sosofo))
   (outside-header (empty-sosofo))
   (inside-footer (empty-sosofo))
   (center-footer (empty-sosofo))
   (outside-footer (empty-sosofo))
   (children (process-children)))
  (make simple-page-sequence
  page-width: %page-width%
  page-height: %page-height%
  left-margin: %left-margin%
  right-margin: %right-margin%
  top-margin: %top-margin%
  bottom-margin: %bottom-margin%
  header-margin: %header-margin%
  footer-margin: %footer-margin%
  left-footer: (if-front-page inside-footer
            outside-footer)
  center-footer: center-footer
  right-footer: (if-front-page outside-footer
             inside-footer)
  left-header: (if-first-page
          (empty-sosofo)
          (if-front-page inside-header
             outside-header))
  center-header: (if-first-page
           (empty-sosofo)
           center-header)
  right-header: (if-first-page
           (empty-sosofo)
           (if-front-page outside-header
              inside-header))
  children))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 8. Element Construction Rules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; BOOK element
(element BOOK
   (generic-page-sequence
    outside-footer: (verbose-footer-page-number)
    outside-header: (my-title)))

;; TITLE element
(element TITLE
   ($para$))

;; PARAGRAPH element
(element PARA
   ($para$))

Despite all the extra options and the use of a procedure, this produces the same result as does using front-page.dsl: