forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyriaque Dupoirieux <Cyriaque.Dupoiri...@pcotech.fr>
Subject Re: [[use of a xconf variable]
Date Mon, 17 Jul 2006 10:34:46 GMT
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
>
>

Mime
View raw message