By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,759 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,759 IT Pros & Developers. It's quick & easy.

Cocoon: variables in the sitemap

P: n/a
mcv

I'm currently learning to use Cocoon, and although I really like it,
there are a couple of things that don't seem to be explained very well.
I've seen lots of articles explaining really complicated stuff with
actions and selectors and stuff, but I can't find a simple explanation
of how variables in the sitemap actually work. Can anyone direct me to
a good article on that?

Another problem I'm having is that for some strange reason, my stylesheet
replaces the XML file, instead of being applied on the XML. What I'm
doing seems right, and my stylesheet looks perfect, but for some reason
it doesn't work.

Below I've included my sitemap file, because I suspect both problems
are caused by me completely misunderstanding how the sitemap works.
Note that apart from these problems, this is a pretty trivial exmaple,
just intended for to learn to use Cocoon.

The "analyse" pipeline should be triggered by a http GET-request that
contains a URL which then needs to be passed to the HTML Generator,
which doesn't seem to work, whatever I try. At the moment I receive
an error that no pipeline matched request analyse. With slight changes
to the sitemap I receive a variety of exceptions, including one that
says a file with the name of the root directory of this project doesn't
exist. When I put a hard URL in the sitemap, I get the stylesheet
problem mentioned above.

<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">

<map:components>
<map:generators>
<map:generator name="html" src="org.apache.cocoon.generation.HTMLGenerator"/>
</map:generators>
<map:transformers>
<map:transformer name="mytransformer" src="MyTransformer"/>
<map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransfor mer"/>
</map:transformers>
<map:serializers>
<map:serializer name="html" mime-type="text/html"
src="org.apache.cocoon.serialization.HTMLSerialize r"/>
</map:serializers>
</map:components>

<map:pipelines>

<map:pipeline>
<map:match pattern="">
<map:generate type="file" src="formpage.html"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>

<map:pipeline>
<map:match pattern="analyse?url-form=*">
<map:generate type="html" src="{1}"/>
<map:transform type="mytransformer"/>
<map:transform type="xslt" src="stylesheet.xsl"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
</map:pipelines>

</map:sitemap>

I'm using Cocoon 2.1.5.1, Java 1.5.0 (shouldn't be relevant) and
Windows 2000 (shouldn't be relevant either).

I'm happy with just a pointer to an article explaining clearly how
these things should work, but if someone could explain it for me here,
that would be great too, ofcourse.
mcv.
Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.