cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn C. Vos" <m....@hippo.nl>
Subject RE: LinkRewriterTransformer question
Date Thu, 02 Mar 2006 14:58:11 GMT

Bruno Dumon [mailto:bruno@outerthought.org] wrote:
>  
>  I would like to use the LinkRewriterTransformer to transform 
>  links like
>  this:
>  
>  myscheme:somevalue
>  
>  to something like
>  
>  http://someserver/some/path/somevalue
>  
>  Thus, the 'somevalue' should simply be prefixed with a static string.
>  
>  This seems like a pretty basic use case but I couldn't figure out how
>  one of the standard input modules of Cocoon could do this. 
>  Does anyone
>  know if this is possible?

Sounds like a pretty standard use for the linkrewriter. The way I use it
is this:

The input module (cocoon.xconf):

  <component-instance name="linkmap"
                      class="org.apache.cocoon.components.modules.input.LocationMapModule"

                      logger="core.modules.lm">
    <file src="site://linkmap.xml"/>
  </component-instance>

Linkrewriter (sitemap.xmap):

  <map:transformer logger="sitemap.transformer.linkrewriter" name="linkrewriter"
        pool-grow="2" pool-max="32" pool-min="2"
        src="org.apache.cocoon.transformation.LinkRewriterTransformer">
    <schemes>linkmap</schemes>
    <link-attrs>href action value src</link-attrs>
  </map:transformer>

And a linkmap that contains stuff like:

  <match pattern="/content/foo/**.xml">
    <location src="/bar/{1}.html"/>
  </match>

Or something like that. I may be forgetting something, and I give no guarantees
that this is correct, but this is what my code looks like, and it seems to work.

In the end, links like 
	linkmap:/content/foo/blah.xml
should be rewritten as
	/bar/blah.html.


mcv.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message