Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 1598

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>2 General structure of a document according to the Oz DTD</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node3.html#chapter.bnf">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.docstruct"><H1><A name="chapter.docstruct">2 General structure of a document according to the Oz DTD</A></H1><P></P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!DOCTYPE</SPAN>&nbsp;BOOK&nbsp;SYSTEM&nbsp;<SPAN class="string">&quot;ozdoc.dtd&quot;</SPAN>&nbsp;[<BR>&lt;!--&nbsp;<SPAN class="comment">entity&nbsp;declarations&nbsp;</SPAN>--&gt;&nbsp;<BR>]&gt;<BR>&lt;<SPAN class="functionname">BOOK</SPAN>&gt;<BR>&nbsp;&nbsp;&lt;<SPAN class="functionname">FRONT</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">AUTHOR</SPAN>&gt;...&lt;/<SPAN class="functionname">AUTHOR</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">AUTHOR</SPAN>&gt;...&lt;/<SPAN class="functionname">AUTHOR</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">META</SPAN>&nbsp;name=comic&nbsp;<SPAN class="variablename">content</SPAN>=<SPAN class="string">&quot;foo.ps&quot;</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">ABSTRACT</SPAN>&gt;...&lt;/<SPAN class="functionname">ABSTRACT</SPAN>&gt;<BR>&nbsp;&nbsp;&lt;<SPAN class="functionname">BODY</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">CHAPTER</SPAN>&gt;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">PART</SPAN>&gt;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">CHAPTER</SPAN>&gt;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">CHAPTER</SPAN>&gt;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">PART</SPAN>&gt;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">CHAPTER</SPAN>&gt;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">CHAPTER</SPAN>&gt;&lt;<SPAN class="functionname">TITLE</SPAN>&gt;...&lt;/<SPAN class="functionname">TITLE</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&nbsp;&nbsp;&lt;<SPAN class="functionname">BACK</SPAN>&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;<SPAN class="functionname">BIB.EXTERN</SPAN>&nbsp;...&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;...<BR>&lt;/<SPAN class="functionname">BOOK</SPAN>&gt;</CODE></BLOCKQUOTE><P> </P><H2><A name="label5">2.1 Entity Declarations</A></H2><H3><A name="label6">2.1.1 Macros</A></H3><P>entities are a bit like macros. You can add entity declarations where it says <CODE>&lt;!--&nbsp;<SPAN class="comment">entity&nbsp;declarations&nbsp;</SPAN>--&gt;</CODE> above. For example: </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;quux&nbsp;<SPAN class="string">&quot;Guy&nbsp;L.&nbsp;Steele&nbsp;JR.&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P> would allow you to type <CODE><SPAN class="variablename">&amp;quux;</SPAN></CODE> in your document, and that would automatically be replaced by ``Guy L. Steele JR''.</P><H3><A name="label7">2.1.2 Include Files</A></H3><P>Another application of entities is to denote files to be included: </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;section1&nbsp;SYSTEM&nbsp;<SPAN class="string">&quot;section1-draft.sgml&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P> would allow you to type <CODE><SPAN class="variablename">&amp;section1;</SPAN></CODE> in your document, and that would be replaced by the contents of file <CODE>section1-draft.sgml</CODE>.</P><H3><A name="label8">2.1.3 Processing Instructions</A></H3><P>Sometimes it is useful to introduce entities that do not expand to text, but should instead be interpreted by the processing system. This is what a processing instruction is for. </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;nbsp&nbsp;PI&nbsp;<SPAN class="string">&quot;NON-BREAKING-SPACE&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P> an occurrence of <CODE><SPAN class="variablename">&amp;nbsp;</SPAN></CODE> in your document will result in an occurrence of the processing instruction object identified as <SPAN class="PI">NON-BREAKING-SPACE</SPAN>. What to do with it is up to the processing system. For example, the LaTeX converter might replace it by <CODE>~</CODE> and the HTML converter by the HTML entity <CODE><SPAN class="variablename">&amp;nbsp;</SPAN></CODE> (surprise, surprise!).</P><P>I recommend that processing instructions be given names that begin with the prefix <CODE>PI:</CODE>, e.&nbsp;g.: </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;nbsp&nbsp;PI&nbsp;<SPAN class="string">&quot;PI:NBSP&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P></P><H3><A name="label9">2.1.4 Marked Section</A></H3><P>It is possible to conditionally include a part of the document: </P><BLOCKQUOTE class="code"><CODE>&lt;![&nbsp;<SPAN class="variablename">%HTML;</SPAN>&nbsp;[...]]&gt;</CODE></BLOCKQUOTE><P> would include <CODE>...</CODE> iff <CODE><SPAN class="variablename">%HTML;</SPAN></CODE> is a (parameter) entity defined as <CODE>INCLUDE</CODE>, i.e. if there is an entity declaration of the form: </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;HTML&nbsp;<SPAN class="string">&quot;INCLUDE&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P></P><P>Normally, the ``entity declarations'' section of your document would contain: </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;LATEX&nbsp;<SPAN class="string">&quot;IGNORE&quot;</SPAN>&gt;<BR>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;HTML&nbsp;&nbsp;<SPAN class="string">&quot;IGNORE&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P> Thus causing marked sections marked with <CODE><SPAN class="variablename">%LATEX;</SPAN></CODE> and <CODE><SPAN class="variablename">%HTML;</SPAN></CODE> to be ignored by default. This is normally overriden on the command line, when invoking the SGML parser, <SPAN class="PROGRAM">nsgmls</SPAN>: </P><BLOCKQUOTE class="code"><CODE>nsgmls&nbsp;-iHTML&nbsp;...</CODE></BLOCKQUOTE><P> this causes the declaration </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;LATEX&nbsp;<SPAN class="string">&quot;INCLUDE&quot;</SPAN>&gt;</CODE></BLOCKQUOTE><P> to override the one in your document. Don't abuse marked sections. A typical use is, in the <CODE>DOCTYPE</CODE> header of your document, to select which entity declarations you want to use according to the target format for processing. </P><BLOCKQUOTE class="code"><CODE>&lt;<SPAN class="keyword">!DOCTYPE</SPAN>&nbsp;BOOK&nbsp;SYSTEM&nbsp;<SPAN class="string">&quot;ozdoc.dtd&quot;</SPAN>&nbsp;[<BR>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;HTML&nbsp;&nbsp;<SPAN class="string">&quot;IGNORE&quot;</SPAN>&gt;<BR>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;%&nbsp;LATEX&nbsp;<SPAN class="string">&quot;IGNORE&quot;</SPAN>&gt;<BR>&lt;![&nbsp;<SPAN class="variablename">%HTML;</SPAN>&nbsp;&nbsp;[<BR>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;target.format&nbsp;<SPAN class="string">&quot;HTML&quot;</SPAN>&gt;<BR>]]&gt;<BR>&lt;![&nbsp;<SPAN class="variablename">%LATEX;</SPAN>&nbsp;[<BR>&lt;<SPAN class="keyword">!ENTITY</SPAN>&nbsp;target.format&nbsp;<SPAN class="string">&quot;\LaTeX{}&quot;</SPAN>&gt;<BR>]]&gt;<BR>]&gt;</CODE></BLOCKQUOTE><P> This would allow you to type <CODE><SPAN class="variablename">&amp;target.format;</SPAN></CODE> in your document and have it expand to either HTML or <CODE><SPAN class="keyword">\LaTeX</SPAN>{}</CODE> according to the target format select on nsgmls's command-line.</P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node1.html#chapter.intro">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node3.html#chapter.bnf">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>