cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Created: Let's get to work
Date Mon, 22 Aug 2005 13:37:27 GMT
A new document has been created.

http://cocoon.zones.apache.org/daisy/cocooninaction/680.html

Document ID: 680
Branch: main
Language: default
Name: Let's get to work
Document Type: Simple Document
Created: 8/22/05 1:37:13 PM
Creator (owner): Helma van der Linden
State: publish

Parts
=====

Content
-------
Mime type: text/xml
Size: 4463 bytes
Content:
<html>
<body>

<p>Now that decisions are made, it is time to put it all to work. First, fire up
Eclipse, open your <em>HealthyCocoon </em>project and create the directory
structure as outlined above under <em>/src/cocoon/webapp/healthycocoon</em> of
your project. Note that <em>healthycocoon </em>is the "root" directory under
<em>webapp</em> and thus <em>webapproot </em>in the description above.
This
makes your project a subproject of the Cocoon webapp. This way, the project
sitemap can remain small. The "root" sitemap (i.e. the default sitemap installed
during the installation of Cocoon) remains untouched and provides a default
setup for most definitions and URLs.</p>

<h3>Create the home page</h3>

<p>The home page will contain the information about HealthyCocoon. It will be
the first page to be shown when the domainname is entered and where all
non-existing pages will be directed to.<br/>
Create a new XML file in <em>src/cocoon/webapp/healthycocoon/content</em> and
name it <em>home.xml</em>. Copy or type the page template, explained above and
set the <tt>title </tt>and <tt>banner </tt>to 'HealthyCocoon welcomes
you'. Copy
or type the text about HealthyCocoon between the <tt>text </tt>tags. Save the
file.<br/>
It looks like this:</p>

<pre>&lt;page&gt;
  &lt;header&gt; 
    &lt;title&gt;HealthyCocoon Welcomes You&lt;/title&gt;
  &lt;/header&gt;
  &lt;content&gt;
    &lt;banner&gt;HealthyCocoon Welcomes You&lt;/banner&gt;
    &lt;text&gt;
      &lt;p&gt;
         HealthyCocoon is a hip restaurant located in the centre of Maastricht, The
         Netherlands. Maastricht is practically on the Belgian border and only some 30 km
         from the German border, which explains our international clientele.
      &lt;/p&gt;
      &lt;p&gt;
         We intend to spoil our customers by serving them fresh, healthy and nutritional
         food served in eye-pleasing and tongue-caressing dishes. Not only do we have ample
         seating inside, but we also have tables and comfortable chairs set up outside for

         those nice days in spring, summer and autumn.
      &lt;/p&gt;
      &lt;p&gt;If you are in a rush, you will find that our dishes are also great
for takeaway.&lt;/p&gt;
    &lt;/text&gt;
  &lt;/content&gt;
&lt;/page&gt;</pre>

<h3>Create the contact page</h3>

<p>Repeat the steps above to create <em>contact.xml</em> which contains
the
addres of HealthyCocoon. Choose an appropriate title and banner. It looks like
this:</p>

<pre>&lt;page&gt;
  &lt;header&gt; 
    &lt;title&gt;HealthyCocoon - Contact&lt;/title&gt;
  &lt;/header&gt;
  &lt;content&gt;
    &lt;banner&gt;Where to find us&lt;/banner&gt;
    &lt;text&gt;
      &lt;p&gt;
         HealthyCocoon is located at:
      &lt;/p&gt;
      &lt;p&gt;
         Webappstreet 25&lt;br/&gt;
         1234 AB Maastricht&lt;br/&gt;
         The Netherlands&lt;br/&gt;
      &lt;/p&gt;
      &lt;p&gt;
         You can reach us:&lt;br/&gt;
         By phone: +31 43 1234567&lt;br/&gt;
         By fax: +31 43 1234568&lt;br/&gt;
         By email: info@healthycocoon.com&lt;br/&gt;
      &lt;/p&gt;
    &lt;/text&gt;
  &lt;/content&gt;
&lt;/page&gt;</pre>

<p class="note">Since these files are XML, you are required to write valid XML.
This means that using HTML tags also requires you to conform to valid XML, hence
the <tt>&lt;br/&gt;</tt> and the closing <em>&lt;/p&gt;</em>.</p>

<h3>Putting it to screen</h3>

<p>Now that you have written the content to start with, it is time to focus on
how to get it to display on screen. For that we need two things:</p>

<ul>
<li>Something, an XSLT stylesheet, that transforms your pages into XHTML.</li>
<li>Something, a sitemap, that does the directory-to-URL mapping as discussed
before.</li>
</ul>

<h3>ToXHTML.xslt</h3>

<p>The XSLT stylesheet that transforms the internal markup to XHTML is
conveniently named <em>ToXHTML.xslt</em>. Create an XSL document in
<em>src/cocoon/webapp/healthycocoon/system/xsl</em>. For now we will create the
simplest stylesheet possible. Enhancements will be added later.<br/>
Create the stylesheet yourself and check if it matches the one below or simply
copy and paste.</p>

<p>[TODO:<br/>
- create xsl files that transform the xml<br/>
- explain about pipelines (enough to understand why there are different xsl
files)<br/>
- create a minor sitemap.xmap<br/>
- run cocoon -&gt; test (only 2 pages, no menu, no language switch, only through
URL modification)<br/>
]</p>

</body>
</html>

Collections
===========
The document belongs to the following collections: ciatutorial

Mime
View raw message