Stuffed Mushrooms
Barbecue
Beverages
Breads
Breakfast
Brunch
Cakes
Candy
Cassaroles
Cookies
Desserts
Dinner
Drinks
Extras
Lunch
Meats
Pies
Poultry
Sauces
Snacks
Soups
Supper
Salads
Recipe Writer
This is the recipe writer (JavaScript) form.
Enter your recipe information and it will generate
the XML code for you to copy and paste to a text
file you will name as your_recipe_name.xml and have
completed your first XML recipe page. Send us a copy
so we might put your recipe on file here with our thanks.
After copying the text to your clipboard, open your favorite text
editor (Notepad, Wordpad, SynEdit, CodeMax or ?) and PASTE . Now
save this file with an extension of xml. (That just means the filename
should end in ".xml" instead of ".txt" or ".htm".)
There are three documents required to make these recipes work.
The DTD, the XSL style sheet, and the actual XML recipe file
This is the code for the DTD
The DTD is responsible for defining the marking up. Note that this file
may have been updated since writing the html code needed for their presentation
here so some actual features may be missing from the code below. The actual DTD is here but you will need to save it and open it with
a text editor to view it instead of simply clicking on the link.
<!ELEMENT recipe
(title, cook, category, description, prep_time, illustration,
ingredients, directions, yield, comment)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT cook (#PCDATA)>
<!ELEMENT category (#PCDATA)>
<!ELEMENT prep_time (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT ingredients (item+)>
<!ELEMENT item (#PCDATA)>
<!ELEMENT ingredient (#PCDATA)>
<!ELEMENT directions (step*)>
<!ELEMENT step (#PCDATA)>
<!ELEMENT yield (#PCDATA)>
<!ELEMENT illustration EMPTY>
<!ATTLIST illustration href CDATA #REQUIRED>
<!ELEMENT comment (#PCDATA)>
This is the code for the XSL style sheet
The style sheet is responsible for marking up the recipes (XML files in general)
into what looks like a regular web page. It includes a lot of html and anything
which is common to all the recipe pages. Note that these files (here) in general
may have been updated since writing the html code needed for their presentation
here so some actual features may be missing from the code below. Click here to view the actual style sheet.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="/">
<html>
<head>
<title>Trillium University Culinary School - Recipe </title>
<style type="text/css">
body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; background-color: #ffffb0;}
a:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: #FF00FF; text-decoration: none}
a:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: #000033; text-decoration: none}
a:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: #0000FF; text-decoration: none}
a:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11pt; color: #999999; text-decoration: none}
h3: {font-size: 1.5em}
</style>
</head>
<body >
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="recipe">
<a href="../../index.html"><img src="../../images/tu.gif" border="0" /> INDEX</a>
<table width="100%"><tr><td>
<b>Category:</b> <xsl:value-of select="category" />
</td>
<td align="right">
<b>Preperation time:</b> <xsl:value-of select="prep_time" />
</td>
</tr>
<tr>
<td colspan="2"><center>
<p style="font-size: 1.25em">
<span style="font-size: 1.2em">
<xsl:value-of select="title" /></span>
</p>
</center></td></tr>
<tr>
<td colspan="2"><center>
<xsl:value-of select="description" />
</center></td></tr>
<tr>
<td colspan="2"><center>
<b>Cook:</b> <xsl:value-of select="cook" />
</center></td></tr>
</table>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="illustration">
<center>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="@href"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</center>
</xsl:template>
<xsl:template match="ingredients">
<h3>Ingredients:</h3>
<p>
<xsl:for-each select="item">
<xsl:value-of/><br/>
</xsl:for-each>
</p>
</xsl:template>
<xsl:template match="directions">
<h3>Directions:</h3 >
<p><ol>
<xsl:for-each select="step">
<li><xsl:value-of/></li>
</xsl:for-each>
</ol>
</p>
</xsl:template>
<xsl:template match="yield">
<p>
<b>Yield:</b>
<xsl:value-of/><br/>
</p>
</xsl:template>
</xsl:stylesheet>
This is the code for the recipe in XML
<?xml version="1.0"?>
<!DOCTYPE recipe SYSTEM "../../dtd/recipe.dtd">
<?xml-stylesheet type="text/xsl" href="../../style/recipe.xsl" ?>
<recipe>
<title>Cake Mix Drop Cookies</title>
<cook>anonymous Industrial cook</cook>
<category>Cookies</category>
<description>Drop cookies made from cake mix package</description>
<prep_time>1/2 Hour</prep_time>
<illustration href="../../images/GARLIC.jpg" />
<ingredients>
<item>Cake Mix</item>
<item>1/2 cup Oil</item>
<item>2 Tablespoons Water</item>
</ingredients>
<directions>
<step>Preheat oven to 350° F.</step>
<!-- ° is the degree symbol -->
<step>Mix all ingredients.</step>
<step>Drop onto ungreased baking sheet and bake 10 min.</step>
</directions>
<yield>20 - 30 cookies</yield>
</recipe>
This is a simple, yet functional example of XML.
To fully understand the relationship between documents,
it may be helpful to understand the directory structure
being used (any could work, but this is how it is done here,
and if you use a different directory structure, you may need to
make many subtle changes through the documents to correct the
links.)
All of this is contained in the directory CookBook and
the full address of THIS page is http://fjd1.com/CookBook/index.html
Within this directory is to also be found "favicon.ico", and
the directories: "/dtd", "/images", "/recipes", "/script", and "/style".
In addition, "recipes" also has directories in it for
categories of recipes. It is within these directories that the XML recipe files reside. Typical of these would be: http://fjd1.com/CookBook/cookies/cakepackagecookies.xml
Within "/dtd" is the file: "recipe.dtd"
Within "/script" is the script on this page "RMLwriter.js" used to write XML recipe documents (above.)
Within "/style" are: "recipe.css" and "recipe.xsl"
Images for everything are contained in "/images".
Note: I have cooked for a couple of restaurants including the Govenor House in Olympia, Washington and worked as the Cook aboard the Cherikoff (a purse seiner out of Craig, Alaska.) I am trying to get a few of my friends (some professional cooks, some just good at preparing food or making wine etc.) interested in
developing an online school of cooking. This recipe collection is the beginning
of this school, and is serving a dual role, perhaps more. These recipe pages (not this page, but the recipe pages linked above in the table of contents) are
written in XML (eXtensible Markup Language) and are a working example for those
who are interested in seeing examples of this code (as well as the related DTD's and XSL required to make them function.) Note the example above; the recipe is
all there. The tags are all understandable to a cook. The webmaster is able
to use this RML (Recipe Markup Language?) with the XSL and DTD to
turn it into a webpage on the fly. The webmaster just needs to teach the cook
how to write in this new RML. Easy eh? (This process is now automated by the form above and all the cook need do now, is fill in the blanks and the entire RML page
will be created fro them. The webmaster now only needs to teach the client/cook
how to paste it as a text file, rename it as an XML-recipe and then upload it to
their website's CookBook directory.) Note also that there are other
more complete recipe markup languages such as the following one identified as
"RecipeML" at http://www.formatdata.com, and that our examples
and recipes here are not derived from theirs. (Their DTD file is called
recipeml.dtd and ours is named recipe.dtd and our's is intentionally less
sophisticated and flexible. If you are looking for an out of the box soution
for your food manufactureing needs we suggest you look there.)
If you would enjoy helping create an
online school of food and drink prep., Send us an email, Trillium University
can use your help. -F. Davies