where can I find that tutorial ? I checked all the cocoon docs and didn't
find it.
are there any other resources ?

thanks
Ricardo Trindade

-----Original Message-----
From: Paul Pattison [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 19 de Abril de 2002 18:43
To: Cocoon Mailing List
Subject: Separation of Concerns (presentation elements)


Hi everyone,

I had a brief stint where I used Jakarta's Turbine project.  One of the
things that I really liked about it was that it divided a page's
presentation elements into a bunch of separate files
(navigation,content,layout,etc).

I guess it didn't really sink in that I could do all that with Cocoon until
a few days ago when I read Andreas Hartmann's 'Creating a Navigation Menu'
tutorial.  I thought this was an excellent tutorial!

The one thing that I wanted to change was the fact that in that tutorial, he
uses a cryptic url pattern to give the sitemap parameters for what section
and style a page should have.  I would prefer to use an ordinary convention
(ie just *.html).  With Turbine, a 'layout' for example was set by calling
the 'setLayoutTemplate("/PrintableLayout.vm")' method at the top of a page.
I really liked how the layout was defined as a part of the page.  So for my
Cocoon page I wanted to have something like this:

<page>
  <layout>homepage.xsl</layout>
  <style>simple-page2html.xsl</style>
  <content>foo</content>
</page>

A 'layout' describes the structure of the page.  This means where the
content, navigation, header and footer go.  A 'style' describes the look of
the content.

But I couldn't figure out how to get these values to the sitemap so that it
could chose the appropriate .xsl files.  Then today I took a stab at
understanding Actions better and it seems to me like this is the approach I
need.  I should create an action that would open my page read the values of
the tags requested and return their values.  I figured I could create this
generic enough that it could be used to read any tag values in any specified
xml document and be used for other purposes.

So here's what my sitemap would include:

<map:match pattern="*.html">
  <map:act type="param-fetcher">
    <!-- page to get values from -->
    <map:parameter name="filename" value="{1}.xml"/>
    <!-- tags to get values from -->
    <map:parameter name="tags" value="style,layout"/>

    <map:generate type="file" src="documents/{1}.xml"/>
    <map:transform src="stylesheets/{style}-html.xsl"/>
    <map:transform src="layouts/{layout}.xsl"/>
    <map:serialize type="html"/>
  </map:act>
</map:match>

Before I wrote the Action I wanted to see what people thought of this
approach.  Is it a good idea?  Is it something that would be helpful to have
as an included Action?  Is there a better way of doing it?

Wow, this was a long email.  If you made it through the whole thing and have
some feedback for me that would be GREAT!!  Thanks in advance.

Paul


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to