cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Lange" <>
Subject LinkRewriter transformer namespace configuration (Cocoon 2.1M1)
Date Sun, 18 May 2003 21:26:22 GMT
Still about the LinkRewriter's configuration, as of Cocoon 2.1M1, there is
another hint perhaps worth mentionning here: it is possible to change the
namespace of the elements handled by the LinkRewriter transformer by
defining a "namespaceURI" parameter to the transformer in the sitemap.

This might seem obvious... indeed, this parameter is available to all
transformer, as it is defined in the AbstractSAXTransformer abstract class,
base of all transformers. But I didn't see it at first, until Jeff Turner
refered me to the AbstractSAXTransformer source code.

Thus, if one wants the LinkRewriter to handle elements from the XHTML
namespace, one would write:

  <map:transform type="linkrewriter" src="cocoon:/{1}/linkmap.abs.xml">

    <!-- Changing Linkrewriter's processed namespace -->
    <map:parameter name="namespaceURI"

    <!-- Other LinkRewriter parameters -->
    <map:parameter name="link-attrs" value="href src onmouseover
    <map:parameter name="schemes" value="phga external"/>
    <map:parameter name="exclude-schemes" value="http https ftp mailto
    <map:parameter name="bad-link-str" value="bad-link"/>

If not already done, may I suggest adding a comment to the Javadoc for this
hint? Thanks!


-----Message d'origine-----
De : Olivier Lange []
Envoyé : dimanche, 11. mai 2003 06:10
À :;
Objet : Linkrewriter dynamic configuration overloading syntax pitfall
(Javadoc out of sync, Cocoon 2.1M1)

Dear all

I had a hard time figuring out how to dynamically overload the configuration
of the input modules used for the LinkRewriter configuration. I believe
there is a syntax pitfall in the Javadoc of Cocoon 2.1M1, the Javadoc being
out of sync on this topic.

I discovered the Linkrewriter in Forrest 0.4, studied its configuration,
then followed the Javadoc and overlooked the sitemap configuration of the
bookdemo and sitedemo samples of Cocoon 2.1M1. Here is a summary.

The Javadoc notes that the "dynamic config syntax [is] different to the
static config syntax (attributes used instead of elements)"
(, lines 114-116). So one is suggested to write:

      <map:transformer name="linkrewriter"
        <input-module name="linkmap" src="{src}" ... />
        ...                          ^^^ attribute: does not work

I tried, but this didn't work. The linkwriter would not use the sitemap's
substitued value of the 'src' attribute to get the "Linkmap", it rather used
the value of the static configuration defined in the cocoon.xconf file:

  <component-instance name="linkmap" ...>
    <file src="cocoon://linkmap"/>

To dynamically overload the cocoon.xconf's static configuration, one has to

  <map:transformer name="linkrewriter" src="..."
    <input-module name="linkmap" ... >
      <file src="{src}"/>

There is actually no difference to the static configuration syntax. The
samples use this later syntax and work fine.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message