contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
SGML to HTML conversions  
Related Concepts  

Introduction

This is a simple but practical example of translating an SGML document. Suppose a programmer wishes to present simple glossaries using a web browser. The most straightforward way of doing this is to convert the glossaries into HTML. A glossary begins with a title followed by one or more entries. An entry consists of the term, followed by a single, one-paragraph definition.

This Document Type Definition permits some markup minimization. Since it is assumed, for instance, that the defined terms are never longer than one input record, a term is ended by a record end ("&#RE"). Various start tags and end tags may be omitted.

An OmniMark program to process this glossary contains a rule for each element type. The actions in the OmniMark rules indicate how HTML tags are inserted around the contents of each element. In these actions, %c represents an element's content (possibly including the content of subelements), and "%n" indicates a line break inserted in the output.

The first rule in the OmniMark program specifies that the content of a glossary element is to be output prefixed by the HTML start tag "<HTML>", and followed by the HTML end tags "</UL>", "</BODY>", and "</HTML>". The rule for title elements specifies the tags surrounding the glossary's title. Since two copies of the title element content are required (one copy to be output within the "title" tags, another to be output in the body of the file between "h1" tags) a temporary local variable "title-text" is defined and the content of the title element is stored there. By storing the content in a local variable, that content can be accessed multiple times (in this case twice) rather than only once. The rule that processes the entry element simply indicates that the content of each is output as a "<LI>" list item. Each entry consists of a term and a definition, whose text is output with "<STRONG>" tagging surrounding the term.

It is important to observe that identical output is generated if the source document is edited by inserting all omitted tags, and placing the existing entry start tags on separate lines.

When translating SGML documents, you never need to be concerned with variations of an SGML source document that, according to the provisions of ISO 8879, do not affect the interpretation of that document.



Sample Files

SGML to HTML conversions
SGML to HTML sample input file
SGML to HTML sample output file
SGML to HTML: sample SGML DTD

Related Concepts  
   Down-translation: translating XML/SGML documents
 
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:46 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.