You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Cyriaque Dupoirieux <Cy...@pcotech.fr> on 2006/07/17 12:34:46 UTC

Re: [[use of a xconf variable]

le 08/06/2006 16:20 Ross Gardler a écrit :
> Cyriaque Dupoirieux wrote:
>>    I want to add a variable to configure the doctype.
>>
>> At the moment we have in the dispatcher internal.xmap :
>>      <map:serializer logger="sitemap.serializer.xhtml" 
>> mime-type="text/html"
>>        name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
>>        src="org.apache.cocoon.serialization.XMLSerializer">
>>        <doctype-public> -//W3C//DTD XHTML 1.0 Strict//EN 
>> </doctype-public>
>>        <doctype-system> 
>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
>>          </doctype-system>
>>        <encoding>UTF-8</encoding>
>>        <indent>yes</indent>
>>        <omit-xml-declaration>yes</omit-xml-declaration>
>>      </map:serializer>
>>
>> And I want to change it into :
>>      <map:serializer logger="sitemap.serializer.xhtml" 
>> mime-type="text/html"
>>        name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
>>        src="org.apache.cocoon.serialization.XMLSerializer">
>> *        <doctype-public>{project:doctype-public}</doctype-public>
>>        <doctype-system>{project:doctype-system}
>>          </doctype-system>*
>>        <encoding>UTF-8</encoding>
>>        <indent>yes</indent>
>>        <omit-xml-declaration>yes</omit-xml-declaration>
>>      </map:serializer>
>>
>> The variables {project:doctype-public} and {project:doctype-system} 
>> have been declared in the forrest-core.xconf :
>>        <doctype-public>@project.doctype-public@</doctype-public>
>>        <doctype-system>@project.doctype-system@</doctype-system>
>
>
> This is not good. Dispatcher is a plugin and forrest-core.xconf is 
> core. Therefore this entry cannot go in there. But all is not lost...
>
> It is exactly this problem (with the Daisy plugin) that prompted me to 
> write the new forrest.properties.xml config system. This is in 0.8-dev 
> and works fully, but it is not documented yet, nor have we moved the 
> samples over to using the new approach. This would require a vote and 
> I've been delaying that until 0.8 is out the door, I don't want 
> testing and design review to get in the way of the release.
Ok, I have added a forrest.properties.xml file in the dispatcher directory :
<?cml version="1.0" encoding="UTF-8"?>
<properties>
  <!-- To be abl to change the doctype-public and doctype-system value. -->
  <property name="dispatcher.doctype-public" value="-//W3C//DTD XHTML 
1.0 Transitional//EN"/>
  <property name="dispatcher.doctype-system" 
value="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
</properties>
>
> The good news is that since the dispatcher is a whiteboard plugin 
> scheduled for release sometime in the 0.9-dev cycle you can safely use 
> it now. In fact, I would encourage you to do so as it will provide 
> further user testing of the feature.
I try,
>
> It's really easy to use. Just add your property to the plugins 
> forrest.properties.xml file (see the Daisy plugin for examples), it 
> will automatically be exposed in the sitemap, just use the usual 
> {project:foo.bar} syntax.
Done,
>
> Values can be overridden in the same way as normal property 
> definitions (i.e. by providing a project or site specific 
> forrest.properties.xml).
>
Cool,
> I'd recommend using a naming convention for properties to prevent name 
> collisions. I've been using "pluginname.foo.bar"
Ok, that's what I have done.
Now, here is the use of the two new properties in the internal.xmap :
<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
       name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
       src="org.apache.cocoon.serialization.XMLSerializer">
*       <doctype-public>{project:doctype-public}</doctype-public>
       <doctype-system>{project:doctype-system}
         </doctype-system>
*       <encoding>UTF-8</encoding>
       <indent>yes</indent>
       <omit-xml-declaration>yes</omit-xml-declaration>
     </map:serializer>
And here is the generated html :

<!DOCTYPE html PUBLIC "{project:dispatcher.doctype-public}" "{project:dispatcher:doctype-system}">


What's wrong ?
Any idea ?
>
> For more info see [1]
>
> Enjoy
>
> Ross
>
> [1] http://issues.apache.org/jira/browse/FOR-588
>
>

Re: [[use of a xconf variable]

Posted by Cyriaque Dupoirieux <Cy...@pcotech.fr>.
le 17/07/2006 12:51 Ross Gardler a écrit :
> Cyriaque Dupoirieux wrote:
>> le 08/06/2006 16:20 Ross Gardler a écrit :
>
> ...
>
>> Ok, that's what I have done.
>> Now, here is the use of the two new properties in the internal.xmap :
>> <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
>>       name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
>>       src="org.apache.cocoon.serialization.XMLSerializer">
>> *       <doctype-public>{project:doctype-public}</doctype-public>
>>       <doctype-system>{project:doctype-system}
>>         </doctype-system>
>> *       <encoding>UTF-8</encoding>
>>       <indent>yes</indent>
>>       <omit-xml-declaration>yes</omit-xml-declaration>
>>     </map:serializer>
>> And here is the generated html :
>>
>> <!DOCTYPE html PUBLIC "{project:dispatcher.doctype-public}" 
>> "{project:dispatcher:doctype-system}">
>>
>>
>> What's wrong ?
>> Any idea ?
>
> I missed the fact you were trying to configure a component with a 
> property. Unfortunately you can't. The prooperties module is loaded 
> during initialisation, i.e. at the same tie as the initialisation of 
> all the components. Therefore the property value is not available at 
> that time.
I am a little surprised because I have tried to replace my new property 
by one already used in the file : {request:locale} (Crazy thing I know)
Like the following :
<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
      name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
      src="org.apache.cocoon.serialization.XMLSerializer">
*      <doctype-public>{request:locale}</doctype-public> *
      <doctype-system>{project:doctype-system}
        </doctype-system>
       <encoding>UTF-8</encoding>
      <indent>yes</indent>
      <omit-xml-declaration>yes</omit-xml-declaration>
    </map:serializer>
And here is the generated html :

<!DOCTYPE html PUBLIC "{request:locale}" 
"{project:dispatcher:doctype-system}">

I think my problem may come what you say, but also of the fact that my 
properties are used in tags and not in tags attribute (like src='...')

>
> Is it possible to configure the serializer params in the match (you'll 
> need to check the Cocoon docs)? If so it will work there.
Exactly as we have done here...
>
> It's worth checking with the Cocoon folk wheter there is a way to use 
> sitemap params in the initialisation of components, but I don't think 
> there is (Bertrand had a similar problem recently with his i18n 
> improvements to Forrest).
Thank you,

Cyriaque,
>
> Ross
>
> Ross
>
>

Re: [[use of a xconf variable]

Posted by Ross Gardler <rg...@apache.org>.
Cyriaque Dupoirieux wrote:
> le 08/06/2006 16:20 Ross Gardler a écrit :

...

> Ok, that's what I have done.
> Now, here is the use of the two new properties in the internal.xmap :
> <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html"
>       name="xhtml" pool-grow="2" pool-max="64" pool-min="2"
>       src="org.apache.cocoon.serialization.XMLSerializer">
> *       <doctype-public>{project:doctype-public}</doctype-public>
>       <doctype-system>{project:doctype-system}
>         </doctype-system>
> *       <encoding>UTF-8</encoding>
>       <indent>yes</indent>
>       <omit-xml-declaration>yes</omit-xml-declaration>
>     </map:serializer>
> And here is the generated html :
> 
> <!DOCTYPE html PUBLIC "{project:dispatcher.doctype-public}" 
> "{project:dispatcher:doctype-system}">
> 
> 
> What's wrong ?
> Any idea ?

I missed the fact you were trying to configure a component with a 
property. Unfortunately you can't. The prooperties module is loaded 
during initialisation, i.e. at the same tie as the initialisation of all 
the components. Therefore the property value is not available at that time.

Is it possible to configure the serializer params in the match (you'll 
need to check the Cocoon docs)? If so it will work there.

It's worth checking with the Cocoon folk wheter there is a way to use 
sitemap params in the initialisation of components, but I don't think 
there is (Bertrand had a similar problem recently with his i18n 
improvements to Forrest).

Ross

Ross