Command Prompt, Inc.
Starting the SGML Document

Starting the SGML Document

>From the Big "K" icon on the taskbar (Start Application), select Applications, then Emacs. The emacs window will appear. Click the Files menu and select Open File.

A minibuffer will open at the bottom of the screen; type in the name of the file with an .SGML extension (i.e. testfile.sgml). A new blank text processing screen (with SGML specific options on the menu) will open. If you are working on a file that already exists, then that file will appear on the screen.

The first item to include in your document is the DTD (Document Type Declaration). For example, the DTD used in this article is:

< !DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">

The important thing to note is the word article. Alternative choices, for example, would be either book or set (a collection of books); these choices depend upon what you are writing.

For short documents (such as articles), this is the only entry required for the DTD. It may be desirable, however, to break longer documents down into separate files. To do this, add an internal subset to the DTD as follows:

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
<!ENTITY rmarsh "Randy Marsh">
<!ENTITY chap1 SYSTEM "chap1.sgm">
<!ENTITY chap2 SYSTEM "chap2.sgm">
]>

The three 'ENTITY' statements are the elements of the document: the root (main document) is named rmarsh, and the two external files (to be brought into the root document) are named sect1 and sect2. These external files can now be added to the root document by using the ampersand symbol:

  <article>
  &sect1;
  &sect2;
  </article>

These files do not need (in fact, must not have) a DTD. They should simply start as:

< section id="sect1" > < title > Sample Section 1 Title < /title >
< para > First paragraph of section 1. < /para >
 .
 .
 .
< /section >

Just to review, I am not going to try to explain every aspect of SGML. The following is an example of the tags (and format) needed for a short article:

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
<article>
<artheader>
  <title>Article's Title</title>
  <author><firstname>EmilioFirstname</firstname>
          <surname>Lastname</surname></author>
</artheader>
<para> ... </para>
<sect1><title>Title of Section</title>
<para> ... </para>
</sect1>
<bibliography> ... </bibliography>
</article>



Copyright © 2000-2010 Command Prompt, Inc. All Rights Reserved. All trademarks property of their respective owners.