Previous Table of Contents Next


Through conditional processing of the attribute value in the stylesheet, you can include additional information in your document output formatting. For this example, suppose you want to include a special warning in all safety related advisories (see fig. 24.7). This warning will display only when the safety attribute of the subject element indicates that it is safety related.


Fig. 24.7  Product advisory formatted output (with safety warning).

To accomplish this in your stylesheet, you can specify specific conditional output processing to be performed on the subject element only when the value of the safety attribute is true (i.e., equal to y). Figure 24.8 illustrates an example of this type of stylesheet processing using the Layout Designer of WordPerfect SGML Edition.


Fig. 24.8  Attribute-based conditional stylesheet processing.


Tip:  
You may notice that the preceding text in the example above has been truncated. It is because WordPerfect/SGML Edition indicates only the initial portion of such lengthy text objects.

Style Inheritance

Through the use of specific formatting instructions for individual elements, you are able to get rather specific in defining the look of a document. Since you can go even further and actually specify specific formats for each element in each of the contexts that it occurs, the ability to specify formats is actually almost endless.

“But wait a minute,” you say. “Is this powerful tool actually an ability or a requirement?” Good question! After all, if you have to define detailed formatting instructions for every element in every context that it occurs, you could easily devote the rest of your life to developing a stylesheet for one complex document.

Fortunately, there is an alternative. Suppose that you want to keep most of the formatting that you were using before you encounter a specific situation in which you have to apply a few changes? Through the use of inheritance, you can do just that.

Because you can often use most of the format properties in effect at the time of an element’s occurrence, you can “inherit” them. Through inheritance, you only need to define those properties which differ from your inheritance. In many cases, the change is minimal.

For example, suppose that you wish to emphasize specific text within a passage. You can do this by defining this text through a special SGML element designed for this (Let’s call it an “emph,” or emphasis element.) A specific example might look like the following in an SGML document instance:

     <para>The use of the <emph>element</emph>is a central feature in
     defining document structure within SGML.<>

In this case, the format changes required are very small. In fact, you may wish to have the only change be a font style change to italics. (Because you have chosen to have all emphasis elements formatted as italics, you don’t have to specify specific element context.)

     <emph>
     [ Start Tag Layout ]
     FONT APPEARANCE = Italic
     <\emph>


Tip:  
Through a bit of planning, the use of inheritance can greatly minimize your use of redundant stylesheet formatting.

Issues in Specialized Output

As noted earlier, the specific features and syntax of output specifications vary between SGML software packages. Historically, the functionality provided in a particular vendor’s package has tended to be oriented to the proprietary processing of that vendor’s software. This is changing through the trend toward increasing communality in output specifications through a common standard. (The move to standards is discussed in “Output Specification Standards” later in this chapter.)

Your needs in output formatting will vary depending upon your mode of output. If your output is printed pages, it will differ from your needs for handling output via electronic display. In the electronic display environment, your output may even differ conditionally, depending upon a number of factors (such as the context of how the reader reached the document section, specific fonts, and the color of the fonts).

Handling Hardcopy/Printed Output

Output formatting for printed documents often focuses upon those issues related to specialized page-based composition. (In general, hardcopy document output places a much higher emphasis upon composition and layout support than that of electronic output.) Such issues may include special support for the following:

  Page numbering
  Header/footer processing
  Loose-leaf change page support
  Advanced composition support
  Wide range of font support
  Special formatting features (kerning, orphan/widow control, and so on)
  Vendor-specific support for specialized composition hardware/software systems

Because in many instances, the output equipment is predetermined, the output specification parameters (and support) may be tailored to a narrow range of devices. For example, book publishers preparing output to be printed on a Romulus 9000 high- speed printer might include commands that would only work when used with Romulus printers.

Handling Electronic Output

Options for the formatting of electronic output can vary significantly from those of hardcopy output. In many systems oriented to electronic output, extensive page-based composition features are omitted since the page-based composition approach is often not used in electronic delivery.

Since an electronic delivery system offers flexibility in user navigation, features which facilitate this are typically included. These features may include extensive support for hyperlinks to other parts of the document (or to other documents entirely) along with specialized search capabilities. Search support may include the capability for advanced features such as sophisticated context-sensitive searches.

Other capabilities important in an electronic environment include support for multimedia objects and the dynamic creation of tables of content based on stylesheet parameters. Sophisticated SGML viewers, such as EBT’s DynaText, can support linkages to external applications to view external data objects, such as graphics and sound/video clips.


Previous Table of Contents Next