> What's a sitemap?

Well, as I said before, it is the file (called sitemap.xmap) which
maps URLs to cocoon behaviour.

Each time a URL request is sent to Cocoon, the sitemap resolver
parses the whole file sitemap.xmap (==the sitemap), tries to 
find which <map:match> elements match the current URL.
It then parses (only) what is inside those map:match,
and for each compoment declaration read, it creates the 
java component that corresponds.

For example, for URL:
http://localhost:8080/cocoon/toto.html

the URL that Cocoon receives is toto.html
(the servlet container handled the first part).

So the sitemap resolver will read the sitemap.xmap file
and try to find all goods <map:match>.

For example <map:match pattern="toto.html">...</map:match>
will be ok for the sitemap resolver, and it will read what's inside this
tag.

Lets' say that:
<map:match pattern="toto.html">
 <map:generate type="file" src="docs/toto.xml"/>
 <map:transform type="xslt" src="stylesheets/toto2html.xsl"/>
 <map:serialize type="html"/>
</map:match>

The sitemap resolver will read that, and 
create a generator, a XSLT transformer and a HTML serializer,
link them one after the other, and launch the pipeline.

The generator make a XML flux from a "file" which is located at
"docs/toto.xml",
then the flux goes through a XML tranformer, which makes a "xslt"
transformation
using the stylesheet available at "stylesheets/toto2html.xsl", then the
resulting
flux is sent to a serializing component, which transforms the input flux
into a "html" flux.
Then Cocoon send the resulting (html) stream to the client side.

Basically, this is the idea behind a sitemap file.

Why is it so nice? Because the sitemap file can be much more complex.

For example, another possibility could have been:
<map:match pattern="toto.*">
 <map:generate type="file" src="docs/toto.xml"/>
 <map:transform type="xslt" src="stylesheets/toto2{1}.xsl"/>
 <map:serialize type="{1}"/>
</map:match>

Exactly the same but we use a wildcard for URL matching.
So the same sitemap text will handle toto.html, toto.csv ...

Note: The {1} is similar to stuff in regexp, it corresponds to the text
matched by the first wildcard in the matching expression.

Quite nice, isn't it?

And this is only the beginning.

FYI, the sitemap file is parsed linearly, the sitemap resolver
tries to get into _every_ map:match it can (it does only if the matching
pattern
is OK for the current URL), and the sitemap resolving stops
as soon as a map:serialize is met successfully.
May be you do not understand this paragraph now, but keep it in mind for the
future.

Understanding Cocoon means that you understand the process of sitemap
resolution.

The other part of the knowledge is to know what components exist.

Note: I left some specific cases, for comprehension.

Feel free to ask on the list.
We all began wondering what's a sitemap :-)

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

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

Reply via email to