Previous Table of Contents Next


Unfortunately, a gargantuan DTD requires a gargantuan document to test it out. The following code is clearly only test code, not a real chapter (although I could increase the thickness of this book dramatically by including one). Nevertheless, this code should test out most of these elements in their natural habitats.

  <?xml version="1.0" STANDALONE="no" encoding="UTF-8"?>
  <!DOCTYPE CHAPTER SYSTEM "http://127.0.0.1/chapter.dtd">
  <CHAPTER>
  <TOC0CT>How to code XML</TOC0CT>
  <INTRODUCTORY>
  <BT>This is a chapter on how to code XML.</BT>
  <BT>This is another bit of intro info.</BT>
  </INTRODUCTORY>
  <ALEAF>
  <TOC1A>Subhead A1</TOC1A>
  <BT>This is A1, from <CITATION>my document</CITATION>.</BT>
  <CC><LC>This is a listing</LC>
  <CLINE>I don't know what to do in this program!</CLINE>
  <CLINE>I don't know what to do in this program!</CLINE>
  </CC>
  <BT>You could have type <USERACTION>exit</USERACTION> instead
  of running the parser.</BT>
  </ALEAF>
  <ALEAF>
  <TOC1A>Subhead A2</TOC1A>
  <BT>This is A2. We'll start with a table, and move on to a B leaf.</BT>
  <TABLE><TBC>This is a sample table</TBC>
  <TH><TBH>Column 1: Time</TBH><TBH>Column 2:
  Money</TBH></TH>
  <TR><TB>Never enough</TB><TB>Can always use more</TB></TR>
  <TR><TB>More than enough</TB><TB>Had enough to begin
  with</TB></TR>
  <SN>From <CITATION>The book of nonsense</CITATION></SN>
  </TABLE>
  <BLEAF>
  <TOC2B>Subhead B1</TOC2B>
  <BT>A C leaf will follow, after the bulleted list.</BT>
  <BL>
  <BLINE>This is the first item of a bulleted list</BLINE>
  <BLINE>This is the second item of a bulleted list</BLINE>
  </BL>
  <CLEAF>
  <C>Subhead C1</C>
  <BT>This is a C leaf which contains a numbered list and a figure.</BT>
  <NL>
  <NLINE>1. This is the first item.</NLINE>
  <NLINE>2. This is the second item.</NLINE>
  </NL>
  <FIGURE><FIGREF SRC="image.tif" TYPE="tiff"/>
  <FG><FIGNUM>101.12</FIGNUM> - The wild boar at rest.</FG></FIGURE>
  </CLEAF>
  <CLEAF>
  <C>Subhead C2</C>
  <BT>This C leaf contains an unnumbered list and a glossary item.</BT>
  <UL>
  <ULINE>This isn't in any order.</ULINE>
  <ULINE>Who needs order?</ULINE>
  <ULINE>Order just gets in the way.</ULINE>
  </UL>
  <GL><GLITEM>Order</GLITEM><GLDEFINITION> Something that gets in
  the way frequently.</GLDEFINITION></GL>
  </CLEAF>
  </BLEAF>
  <ICON><NOTE/><BT>Hope you enjoyed the chapter!</BT></ICON>
  </ALEAF>
  </CHAPTER>

The code rolls through the parser quite happily. The output is eight pages long and completely repeats the document except in formatting, so I will omit it here.

A Style Sheet for the Chapter DTD

A style sheet for the Chapter DTD won’t be too hard to develop, even though the publishers may grumble about losing the fine control they had with previous desktop publishing tools, like QuarkXPress. Even though XML’s supporting style technologies will allow some fairly intricate formatting, it’s still a great distance from what designers are used to.

Remember that the browser developers haven’t quite caught on to the possibilities of XML yet, at least as of version 4.0 of either the Netscape or Microsoft browsers. The browsers are also fairly far behind in implementing CSS. The following style sheets comply fully with the standards but will not work with most browsers at present.

Documents created with the Chapter DTD will probably be combined with other chapters as part of a larger structure, which may have its own formatting rules. For the purposes of this style sheet, we’ll assume that chapters start and end on their own pages, and that the larger document’s structure will not interfere with any of the styling that will be created later.

The format of this particular style sheet has very little to do with the way the document is presented in the final printing—it is just a generic representation that helps the author and the editors see the book. After the editing is over, the production staff could in theory just replace the style sheet with a style sheet customized for the look of a particular book and have the same elements fall into their proper place for printing.


Previous Table of Contents Next