]> granicus.if.org Git - docbook-dsssl/commitdiff
Literate improvements suggested by Tony Coates
authorNorman Walsh <ndw@nwalsh.com>
Sun, 6 Jan 2002 19:16:48 +0000 (19:16 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 6 Jan 2002 19:16:48 +0000 (19:16 +0000)
litprog/example/doc.xweb
litprog/example/fib.xweb

index 8e081edb928b0c179349f80b428dda959748b20e..11d3d153c87ac9243c8d1a6a88ccbf604d9541d7 100644 (file)
@@ -12,8 +12,8 @@
 <p>This schema defines elements in the
 <tt>urn:publicid:-:Norman+Walsh:Schema Example:EN</tt> namespace.</p>
 
-<p>This schema defines several complex types and several elements that
-are instances of those types.</p>
+<p>This schema defines several elements and their complex types.
+</p>
 
 <src:fragment id="top" mundane-result-prefixes="ex xs">
 <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
@@ -26,6 +26,19 @@ are instances of those types.</p>
 </src:fragment>
 </div>
 
+<div>
+<h1>The Elements</h1>
+
+<p>This schema defines one element of each <a href="#types">complex
+type</a>.</p>
+
+<src:fragment id="elements">
+  <xs:element name="doc" type="ex:doc"/>
+  <xs:element name="para" type="ex:para"/>
+  <xs:element name="title" type="ex:title"/>
+</src:fragment>
+</div>
+
 <div>
 <h1><a name="types"/>The Complex Types</h1>
 
@@ -38,6 +51,17 @@ are instances of those types.</p>
   <src:fragref linkend="para.type"/>
 </src:fragment>
 
+<div>
+<h2>The <tt>role</tt> Attribute</h2>
+
+<p>Each of the complex types in this schema allows an optional role attribute.
+The role attribute is simply a string.</p>
+
+<src:fragment id="role.attrib">
+    <xs:attribute name="role" type="xs:string"/>
+</src:fragment>
+</div>
+
 <div>
 <h2>The <tt>doc</tt> Type</h2>
 
@@ -62,20 +86,9 @@ are instances of those types.</p>
     <xs:anyAttribute namespace="##other" processContents="lax"/>
   </xs:complexType>
 </src:fragment>
-
-<div>
-<h2>The <tt>role</tt> Attribute</h2>
-
-<p>The role attribute is an optional string.</p>
-
-<src:fragment id="role.attrib">
-    <xs:attribute name="role" type="xs:string"/>
-</src:fragment>
-</div>
 </div>
 
 <div>
-
 <h2>The <tt>para</tt> Type</h2>
 
 <src:fragment id="para.type">
@@ -86,17 +99,4 @@ are instances of those types.</p>
 </src:fragment>
 </div>
 </div>
-
-<div>
-<h1>The Elements</h1>
-
-<p>This schema defines one element of each <a href="#types">complex
-type</a>.</p>
-
-<src:fragment id="elements">
-  <xs:element name="doc" type="ex:doc"/>
-  <xs:element name="para" type="ex:para"/>
-  <xs:element name="title" type="ex:title"/>
-</src:fragment>
-</div>
 </html>
\ No newline at end of file
index b5a5aaef2ce9075303a4641facfc3d5acf16edda..2ba8c0c5f4b13e5ccf7d297ef641e1adedf12cdd 100644 (file)
@@ -13,6 +13,20 @@ implementation of the Fibonacci series in Perl. The principal
 motivation for this document is to demonstrate the use of Literate XML.
 </para>
 
+<section><title>Recursive Definition</title>
+
+<para>The Fibonacci series begins: 1 1 2 3 5 8 13... Each member of
+the series, after the first two, is the sum of the preceding two
+members.</para>
+
+<para>This can be implemented recursively by calculating the preceding
+two members of the series and returning their sum:</para>
+
+<src:fragment id="sub.fib.recursion">
+&amp;fib($n-2) + &amp;fib($n-1);
+</src:fragment>
+</section>
+
 <section><title>The <function>fib</function> Function</title>
 
 <para>The heart of this program is the recursive function that
@@ -32,24 +46,9 @@ sub fib {
     }
 }
 </src:fragment>
-
-<section><title>Recursive Definition</title>
-
-<para>The Fibonacci series begins: 1 1 2 3 5 8 13... Each member of
-the series, after the first two, is the sum of the preceding two
-members.</para>
-
-<para>This can be implemented recursively by calculating the preceding
-two members of the series and returning their sum:</para>
-
-<src:fragment id="sub.fib.recursion">
-&amp;fib($n-2) + &amp;fib($n-1);
-</src:fragment>
-
-</section>
 </section>
 
-<section><title>Preamble</title>
+<section><title>Code Preamble</title>
 
 <para>The program preamble simply establishes a default location for
 the Perl executable and informs the interpreter that we want to use