forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <>
Subject explain sitemap matches and pass parameters to transformers
Date Wed, 26 Apr 2006 03:09:09 GMT
Web Maestro Clay wrote in thread "Re: ODT: adding":
> Ferdinand Soethe wrote:
> >Clay Leeds wrote:
> >
> >>Do you have a link or path to the file? I surfed svn a bit, and the
> >>Forrest HowTo section a bit, but couldn't find it.
> >
> >No but you could check if the sample file openoffice-writer-howto.sxw
> >still works ok and if so find out where it is processed. Probably as
> >part of the normal writer-document processing.
> Thanks! That was the clue I needed. It wasn't in the HowTo section...
> It was in the OOo-Writer section.
> I checked, and it doesn't help. It's done there the same way it was
> done in OOo (by passing the '$filename' xsl:variable). In addition to
> getting the data out of the meta.xml file, I'll have to figure out
> how to pass the variable through to the odt_to_xhtml.xsl stylesheet.
> Thanks for remembering!

There are explanations of this in our mail archives, e.g.

I will spend some time to explain this again below
to hopefully add this to a doc later.

Also, when you need to find info like this try doing:
cd $FORREST_HOME/webapp
grep path *.xmap
vi linkmap.xmap
at around line 66 ...
<map:match pattern="**linkmap-*">
  <map:generate src="cocoon://abs-linkmap" />
  <map:transform src="{lm:transform.linkmap.linkmap-relativized}">
    <map:parameter name="path" value="{1}{2}" />
    <map:parameter name="site-root" value="{conf:project-url}" />
  <map:serialize type="xml" />

I hope that i don't confuse with that linkmap
example, but i don't have time to find a better one.
For each page that Cocoon processes, it does an internal
request for a map of links of the page. So a request for
will include an internal request for

To understand the value="{1}{2}" one needs to
understand the Cocoon sitemap. Here is one doc,
there might be better ones.

Basically in the linkmap.xmap example above:
** matches path elements of the uri including /
* matches path elements of the uri excluding /
{1} is the first matched pattern
{2} is the second matched pattern
when tested against a uri like localhost/samples/subdir/linkmap-foo.html
{1} would yield "/samples/subdir/"
{2} would yield "foo.xml"

Here is another example. The match pattern "**/*.html"
when tested against a uri like localhost/samples/subdir/foo.html
{1} would yield "/samples/subdir"
{2} would yield "foo"
{0} would yield "/samples/subdir/foo.html"

Whereas this pattern "/*/*/*.html"
{1} would yield "samples"
{2} would yield "subdir"
{3} would yield "foo"
{0} would yield "/samples/subdir/foo.html"
and a uri like "/samples/bar.html" would not
be matched at all.

To complete the explanation, consider a regexp match
<map:match type="regexp" pattern="^(.*?)([^/]*).xml$">
when tested against a uri like localhost/samples/subdir/foo.xml
{1} would yield "/samples/subdir/"
{2} would yield "foo"

So getting back to our example linkmap.xmap
the <map:parameter name="path" value="{1}{2}" />
will pass a variable into that transformer replacing
those {1}{2} to become
<map:parameter name="path" value="/samples/subdir/foo.xml" />

Looking up the locationmap will find that the
transformer is webapp/resources/stylesheets/relativize-linkmap.xsl
and the $path variable is used in the stylesheet.

These other docs help with sitemap understanding:
and see the Cocoon references.

We need FAQs or docs about these two or even combined topics:
* passing variables from sitemap to transformers
* interpreting sitemap matches


View raw message