Previous Table of Contents Next


Declaring Marked Sections

To indicate a marked section, you must use the marked section declaration in your SGML document instance (rather than in your DTD). By using this declaration, you indicate the section’s status (such as INCLUDE or IGNORE ), followed by the actual content within the section.


Fig. 16.4  The marked section declaration.

The status keyword can be one of the types illustrated in table 16.2. Notice that you can nest some types of marked sections.

Table 16.2 Marked Section Status Keywords

Keyword Usage Nested Marked Sections Allowed

INCLUDE Section is included in processing and is parsed. Yes
IGNORE Section is not included in processing. Parsing of the section is limited to the recognition of any ’begin marked section’ and ‘end marked section’ nested within this section. Yes
CDATA Section is included. Contents are not parsed. No
RCDATA Section is included. Entity references and character references are resolved by parser. No
TEMP Used mainly for easy identification of section that can later be removed. Similar to INCLUDE. Yes

Where nested marked sections are allowed, those sections nested within another marked section will be processed according to the processing of the parent. That is, a nested IGNORE section within an INCLUDE section, will be ignored (based on its own keyword value). However, an INCLUDE section within an IGNORE section will also be ignored (based upon its parent section keyword value).

The CDATA type of marked section is useful when the marked section includes content that may otherwise be (incorrectly) interpreted as SGML content by the parser. Through the CDATA keyword, the parser knows to ignore any markup within this section.

Include and Ignore Processing

Used by itself, the marked section is of limited value in building conditional documents. After all, if you have a document with a number of sections that looks like figure 16.5, making any conditional changes can be both tedious and cumbersome.


Fig. 16.5  When used by itself, a marked section can be difficult to maintain.

Fortunately, there is an easy solution to this dilemma; use entities to define your marked sections. The following section shows you how to accomplish this.

Using Entities with Marked Sections

As you recall the example of the ship engine maintenance manual earlier in the chapter, remember that there are four levels of engine maintenance:

• Level 1 User Maintenance
• Level 2 Field Representative Maintenance
• Level 3 Depot Level Maintenance
• Level 4 Overhaul Facility

As the levels increase, the technical information included in your manual becomes increasingly complex. Because repair personnel familiar with higher levels of maintenance are also familiar with the lower levels, you want to include all lower levels of maintenance up to the level that a person is qualified for.

Suppose you want to deliver a manual that includes those sections up to a Level 3. How would you do this with entities and marked sections in your document instance? Figure 16.6 illustrates how you might go about building your conditional document.


Fig. 16.6  When used in combination with entities, marked sections can be both easy to maintain and a powerful mechanism for making conditional documents.

Notice, in this example, that you have defined several entities that correspond to the maintenance level to be addressed (Level 1, Level 2, etc.). Because you want to include all levels up to the level a person is qualified for (Level 3 for this example), you have set Levels 1, 2, and 3 as INCLUDE in your entities. Level 4 is set to IGNORE because you do not wish to have it processed in your document.

In this example, you wanted to make a document that included progressively more detailed information. In other cases, you might have either/or situations where the document conditionally includes one set of information or another (such as with different language versions of the same document). To achieve this, you can simply set one marked section entity at a time.


Tip:  
This sample document fragment is constructed for a conditional hardcopy document. If you want to deliver a conditional document electronically, you can set the appropriate entities earlier, external to this document section. (Recall, from Chapter 10, that only the first declaration of an entity is processed.)

Including Specialized Content

Because SGML is a markup language for text, it does not directly support other forms of data content. In many documents, you might want to include other data objects, such as graphical figures or equations. For electronic documents, you might want to include multimedia content, such as sound or video clips.

One mechanism provided in SGML to handle non-textual content is the NOTATION declaration. Through it, you can include data that can be “excused” from evaluation by the SGML parser.


Previous Table of Contents Next