Previous Table of Contents Next


Chapter 24
Understanding and Using Output Specifications

Chapter 2, “SGML View of the World: Structure, Content, and Format,” examined a central concept of SGML: documents consist of structure, content, and format. As you explored this view of documents, you could see the value of separating these three components to enhance a document’s usability and portability.

You saw how the SGML world defines a document’s structure with a DTD. After extracting the formatting component, the document content is contained in an SGML document instance, which consists of the text of the document surrounded by the document’s SGML tag set.

But what about the document’s format? As you saw in Chapter 2, processing instructions for a document’s format is a major portion of word processors’ proprietary document formats. In a similar vein, a document’s format is often highly specific to the medium of the document’s delivery. That is, formatting for a printed version of a document can vary quite a bit from the formatting of the same document to be delivered across the World Wide Web.

A major rationale for adopting SGML is output flexibility. This can range from flexibility in document authoring systems to that of document delivery methods.

This chapter examines the ways and mechanisms for specifying the output formatting of your SGML documents. To do this, you will look at the following items:

  A view of a document from an output perspective
  Issues involved with output specifications
  Handling hardcopy/printed output
  Handling electronic output
  Handling dynamic documents
  Difficulties with output specifications
  Output specification standards

The View of a Document from an Output Perspective

To understand the role of output specifications, think for a moment of a specific document instance in SGML. It consists of textual information structured via tags that relate document content back to the structure defined in its controlling DTD.

Put another way, the document instance can be thought of as a hierarchy of elements, with each occurrence of an element having a specific relationship to its parent, child, and sibling elements.

Let’s take a look at an example. In Chapter 8, you examined a DTD for a book. Let’s take a look at a revised version of that DTD (see fig. 24.1).


Fig. 24.1  A DTD defines a specific document structure or hierarchy of elements. Each occurrence of an element has a specific relationship to its parent, child, and sibling elements.

Note that the element Title is included as a subelement in four element declarations: Foreword, Chapter, CSect, and Table.

It is often important to treat the formatting of an element differently according to where it occurs within the document hierarchy. For example, you might want to format the element Title one way when it occurs within a Chapter, and another way when it occurs within a chapter section (CSect). To do this, think of the SGML document instance as a hierarchy.

Let’s take a look at a specific example where you want to format elements differently and see how to go about it.

Formatting Elements Through Their Structural Occurrence

In the book DTD, the Title element occurs within the declaration of several parent elements. As you are laying out the output specification for a book, consider how you’ll format this element when it occurs within a Chapter element and a chapter section (CSect) element. The formatting that you’ll want to have is shown in figure 24.2.


Fig. 24.2  Desired output formatting sample.

Notice that the chapter title, “Back To the Future,” has significantly different formatting than the title for the chapter section (“Case Study: International Food Franchising”).

Table 24.1 lists the format properties of the two occurrences of the Title element.

Table 24.1 Sample Element Formatting Properties

Element Context Description

Title child of: Chapter element Precede with New Page, and text “Chapter:“
19 Point Bold Font
Follow with:
New Line
Horizontal Line
Revert to Former Font
Title child of: Chapter Section element (CSect) Precede with New Line
13 Point Times Bold
Italic Font
Follow with:
New Line
Revert to Former Font

Because you can specify each occurrence of the Title element in the document hierarchy, it is relatively simple to differentiate the formatting by situation (or context).

Let’s take a look at how you can go about doing this.


Note:  
The actual syntax for defining the output format will differ depending on the type of output specification used. The examples illustrated here were prepared using the Layout Designer provided with WordPerfect SGML Edition.

Let’s start with a look at the output format for the Title element when it occurs as a child of Chapter (see fig. 24.3).


Fig. 24.3  Output specification formatting: Title element as a child of Chapter.

Notice that the definition of the element begins with notation that indicates its context: the <Title> element as a child of the <Chapter> element.

In this context, you specify the formatting characteristics that you want for this element. These include:

  A specific font size
  Beginning this element on a new page
  Inclusion of standard text preceding the Chapter element
  A specific font appearance (Bold)

The processing instruction delimiter [ Start Tag Layout ] indicates the start of format instructions to be applied to this data object. The format properties that are defined will be applied when the processing system encounters the start tag indicating the Title element as a child of the Chapter element.


Previous Table of Contents Next