5. Full Example

This example is the file xdoc/authoring-doc.xml used to generate the document you are reading. Notice the use of the <include> element to include (parts of) XML files.

1: <?xml version="1.0" encoding="UTF-8"?> 2: <!DOCTYPE doc SYSTEM "nl/justobjects/xbook/rsc/dtd/doc.dtd" > 3: 4: <doc> 5: <!--{doc.front --> 6: <front> 7: <title>XBook - Authoring Documents (doc.dtd)</title> 8: 9: <id>$Id: authoring-doc.xml,v 1.4 2003/01/06 10:28:08 just Exp $</id> 10: 11: <author> 12: <name>Just van den Broecke</name> 13: <organization>Just Objects B.V.</organization> 14: <email>just@justobjects.nl</email> 15: </author> 16: 17: <date>July 8, 2002</date> 18: 19: <abstract> 20: This document describes how to author documentation using doc.dtd provided with XBook. 21: This DTD can be used to author structured documents like articles, design documentation, manuals etc. 22: In fact this very document you are reading is written according to doc.dtd. 23: </abstract> 24: </front> 25: <!--}doc.front --> 26: 27: <!--{doc.middle --> 28: <middle> 29: 30: <section1 title="Overview"> 31: <para> 32: THIS ENTIRE DOCUMENT IS WORK IN PROGRESS 33: </para> 34: <para> 35: This DTD defines a structured document suitable for articles, memos, manuals (like this one!) and 36: design documentation. The document structure is kept reasonally simple. Each document has has 37: three top elements: the front, the middle and the optional back. 38: </para> 39: <para> 40: Most of the tags in doc.dtd are included from text.dtd. 41: See the <link href="authoring-text.html">Authoring Text (text.dtd)</link> guide. 42: </para> 43: <para> 44: Power users may immediately go to the <link href="#dtd.def">DTD definition</link>. 45: </para> 46: </section1> 47: 48: <section1 id="doc.front" title="The Front"> 49: <section2 title="Purpose"> 50: <para>Provide an element to define all meta information on the document like title, authors, date etc. 51: </para> 52: </section2> 53: <section2 title="Example"> 54: <section3 title="Construct"> 55: <para>The front of this guide is displayed below. Note that you may also use multiple <code>author</code> elements.</para> 56: <listing> 57: <include href="authoring-doc.xml" range="doc.front" /> 58: </listing> 59: </section3> 60: </section2> 61: </section1> 62: 63: <section1 id="doc.middle" title="The Middle"> 64: <section2 title="Purpose"> 65: <para>Provide an element to define all content of the document. 66: </para> 67: </section2> 68: <section2 title="Example"> 69: <section3 title="Construct"> 70: <para>The middle of this guide is displayed below. Note that you only are allowed to use <code>section1</code> 71: elements as childs of the middle section. Different as in HTML the <code>section[1-8]</code> 72: elements must enclose the entire section text. You may nest sections up to section8 (special feature for Jan-Marten).</para> 73: <listing> 74: <include href="authoring-doc.xml" range="doc.middle" /> 75: </listing> 76: </section3> 77: </section2> 78: </section1> 79: 80: <section1 id="doc.back" title="The Back"> 81: <section2 title="Purpose"> 82: <para>Provide an element to define a back section of the document. 83: </para> 84: </section2> 85: <section2 title="Example"> 86: <section3 title="Construct"> 87: <para>The back of this guide is displayed below. Note that you may leave out the <code>back</code> entirely.</para> 88: <para>Linking: you may use the "id" of each <code>reference-item</code> for internal linking with the <code>link</code> element 89: similar to linking to <code>anchor</code> and <code>section[1-4]</code>.</para> 90: <listing> 91: <include href="authoring-doc.xml" range="doc.back" /> 92: </listing> 93: </section3> 94: </section2> 95: </section1> 96: 97: <section1 title="Full Example"> 98: <para> 99: This example is the file <code>xdoc/authoring-doc.xml</code> used to generate the document you are 100: reading. Notice the use of the <code>&lt;include&gt;</code> element to include (parts of) XML files. 101: </para> 102: <listing> 103: <include href="authoring-doc.xml" /> 104: </listing> 105: </section1> 106: 107: <section1 id="dtd.def" title="DTD Definition"> 108: <para>Below is the actual DTD file.</para> 109: <listing> 110: <include href="assets/doc.dtd" /> 111: </listing> 112: </section1> 113: 114: 115: </middle> 116: <!--}doc.middle --> 117: 118: <!--{doc.back --> 119: <back> 120: <reference-list> 121: <reference-item id="W3C"> 122: World Wide Web Consortium. <link href="http://www.w3.org"> 123: http://www.w3c.org</link> 124: </reference-item> 125: <reference-item id="W3C-XML"> 126: World Wide Web Consortium. <strong>Extensible Markup Language (XML) 1.0.</strong> 127: W3C Recommendation; <link href="http://www.w3.org/TR/1998/REC-xml-19980210"> 128: http://www.w3.org/TR/1998/REC-xml-19980210</link> 129: </reference-item> 130: </reference-list> 131: </back> 132: <!--}doc.back --> 133: </doc>