<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="handout-x.css"?>
<!-- ?xml-stylesheet type="text/xsl" href="handout.xsl"? -->
<?xml-stylesheet type="text/xsl" href="/home/lou/CurrentTalks/twocults.xsl"?>
<!DOCTYPE TEI.2 PUBLIC "-//TEI//DTD TEI Lite 1.0//EN" 
   "/TEI/Lite/DTD/teixlite.dtd" [
<!ATTLIST xref url CDATA #IMPLIED>
]>
<TEI.2>
  <teiHeader type="text" status="new">
    <fileDesc>
      <titleStmt>
	<title>Baking your own pizza</title>
      </titleStmt>
      <publicationStmt>
	<p>For TEI web site</p>
      </publicationStmt>
      <sourceDesc default="NO">
	<p>No source: this the original</p>
      </sourceDesc>
    </fileDesc>
  </teiHeader>
  <text>
    <body>
      <!-- one of (eg bibl biblFull l lg p sp cit q label list
      listBibl note stage div div0 div1) -->
<div>
      <head>Baking your own pizza</head>

<p>In this exercise, you will use the TEI pizza chef in
order to make a special purpose XML dtd. You will need access to an
internet browser such as IE5, Netscape, or Opera, and some experience
of using Windows.</p>

<p>Our goal in this exercise is to make a very very simple DTD, which
we can use to mark up a multimedia document. We don't need anything
like the full complexity of TEI Lite, much less the full TEI. We just
want to mark up headings, dates, lists, paragraphs, figures and
... sound clips. Unfortunately, the TEI Guidelines don't seem to have
an element specifically for marking up sound clips, so we need to
invent it. While we are being imaginative, we will also add a
<ident>scale</ident> attribute to the existing TEI <gi>figure</gi>
element.
</p>

<list type="numbered">

<item>Go to the URL
<xref>http://www.hcu.ox.ac.uk/TEI/pizza.html</xref> and read the
general discussion of how the Pizza Chef works.</item>

<item>Choose the tagsets you want: for this exercise, select the prose
base and the figures topping. (This means you should uncheck two of
the three toppings that the chef offers you -- linking and analysis)
If you want to read about a tagset in detail, you can click on its
name to browse the full text of the relevant part of the TEI
Guidelines. </item>

<item>The next section of the pizzachef web page concerns character
entity sets; you can safely ignore these for the moment.</item>

<item>The two tagsets chosen contain many more elements than we need,
so we will create an extension file which ignores most of them. Click
on the button which reads <code>Generate Local Modifications Files
(B)</code> - by default we want to ignore all the elements.</item>

<item>You will see a list of all the tags now available for inclusion
in your DTD. Click on any element name to see full information about
it. Check the first of the three tick boxes to the right if you want
to include the element in your dtd. For this exercise, we will need
only the following elements: <gi>body</gi>, <gi>date</gi>, <gi>div</gi>,
<gi>head</gi>, <gi>item</gi>, <gi>list</gi>, <gi>note</gi>,
      <gi>p</gi>, <gi>respStmt</gi>, <gi>TEI.2</gi>,
<gi>text</gi>, and <gi>title</gi>. In addition, we will need the
      <gi>figDesc</gi> element from the tagset for figures and tables.
</item>


<item>Click on the <ident>Send me the TEI.extensions.ent file</ident> button. The
pizzaChef will now send you a TEI extension entity file. Depending on
your browser settings, you may see this displayed, or the browser may
ask if you want to save it. Either way, make sure you do NOT save it
      as an HTML file. (If you do, you will have to edit the HTML
      header and footer out of the file before you can use it). If
      possible, save it on your
local disk with the name <ident>exercise.ent</ident>, though some
      browsers may insist on naming the file <ident>exercise_ent.txt</ident>.
Use the BACK button to return
to the browser window (if it has expired from the cache you may have
to reload it)</item>

<item>Although we want to use the <gi>figure</gi> element in this
exercise, we want to simplify its content model and add an
attribute. Find this element in the list and click on the third of the
three check boxes to indicate that you plan to modify it.</item>

<item>Click on the <ident>Send me the TEI.extensions.dtd file</ident> button. The
pizzaChef will now send you a TEI extension DTD file, which you should
save on your local disk with the name <ident>exercise.dtd</ident>, in
the same way as before</item>

<item>Minimize the web browser window, and open the second of the two
files you have just received from the pizzachef using Wordpad, or the
editor of your choice, i.e. emacs. You will see that it contains the standard TEI
definition for the <gi>figure</gi> element, which currently reads
<eg><![CDATA[ 
<!ELEMENT figure - - (head?, p*, figDesc?, text?)>
<!ATTLIST figure %a.global entity ENTITY #IMPLIED>
]]></eg>
Using the editor,
change this declaration to read
<eg><![CDATA[ 
<!ELEMENT figure - - (head?, figDesc)>
<!ATTLIST figure %a.global entity ENTITY #IMPLIED
                 scale CDATA "100">
]]></eg>

and save the file.</item>

<item>Since we also want to add a new element to the DTD, not defined
by the TEI, its definition must be added to this same extensions.dtd
file. Type in the following declaration for the new element, and
save the DTD file again
<eg><![CDATA[ 
<!ELEMENT soundClip  - o (date) >
<!ATTLIST soundClip %a.global; 
                    entity ENTITY #IMPLIED
                    duration CDATA #REQUIRED >
]]></eg>
</item>

<item>We are not quite finished. Simply defining a new element does
not include it in the content model of any other element: the easiest
way of doing that is to include it in one of the TEI model classes,
which involves modifying the corresponding parameter entity in the
extensions.ent file. Open the  <ident>exercise.ent</ident> file with your
editor.</item>

<item>As you see, this file is mostly composed of "IGNORE"
declarations for the elements we are not using from our chosen
tagsets.  To add the <gi>soundClip</gi> element to the
<ident>data</ident> class, simply type <code>&lt;!ENTITY % x.data
"soundClip|"></code> at the start of the file. (The space after the
percent sign, and the vertical bar are both essential!). Save the
file</item>

<!--
<item>We've prepared a little test program which you can use to check
that you've made your edits correctly: look in your folder, and you
will see a file called <ident>testmods.dtd</ident>.  Double-click on
it, and you will open it up with emacs (we will show you emacs in more
detail next week). For now, all you need to do is select VALIDATE from
the SGML menu (or type CTRL-C CTRL-V). If all is well, you will see
the following message: <code></code> If you get any other message,
your extensions files are incorrect. The error message will at least
tell you the line number where you went wrong, if you don't undertand
anything else about it!</item>
-->

<item>Once you're happy with your extensions file, it's time to send
them to the pizzachef. Open the browser window again. Press the Back
button to go back to the main pizzachef page, and scroll down to the
point where you are invited to specify the names of your extension
files. Use the browse button to locate first the extensions.ent file
and next the extensions.dtd file.</item>

<item>Scroll down to Step 5, near the end of the page. Select option b
<code>XML with no tag omissibility information</code>. Press the
<code>Generate full DTD button</code>. The pizzachef will now send you
another file, which contains your compiled XML dtd. Save it under the
name <ident>myPizza.dtd</ident>. Congratulations! You have made
a valid XML dtd!</item>

<!--
<item>Experiment with your DTD in Xmetal. Create a new document. When asked,
select "blank XML document", and when asked to specify a DTD file, 
locate your newly created
DTD. You can now define styles, enter data, etc. for your new TEI
conformant DTD.</item>
-->

<item>Start emacs and open a new XML file. Type in the following two
lines at the start:<eg><![CDATA[
<?xml version="1.0"?>
<!DOCTYPE TEI.2 SYSTEM "myPizza.dtd">
]]></eg>
Go to the DTD menu and select the first option <code>compile
DTD</code>. You should now find that the <code>Markup</code> menu will
offer you only elements from your new DTD. </item>


<item>You may wonder why your DTD contains more elements than you
specified above. Because the TEI Header is a mandatory component of
every TEI document, the current version of the pizza chef does not
allow you to modify it in any way. However, you should find that once
you start entering material into the <gi>body</gi> of your document,
the number of elements available to you is drastically
reduced. Welcome to the wonderful world of document standards!</item>
</list>
</div>
</body>

  </text>
</TEI.2>







