cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Daniel <alexander.dan...@gmx.at>
Subject Re: Setting up Saxon in a Maven built Cocoon application
Date Mon, 06 Oct 2008 15:21:46 GMT
On 20.06.2008, at 20:48, Sylvain Desvé wrote:

> RESOLVED
>
> I finally managed to do it. For those who encounter the same  
> problem, here's what I did.

Thanks a lot for sharing!


> 3. I edited sitemap.xmap and added a component :
>
> <map:components>
>     <map:transformers default="xslt">
>       <map:transformer name="xslt-saxon" pool-grow="2" pool-max="32"  
> pool-min="8"
>           src="org.apache.cocoon.transformation.TraxTransformer">
>         <use-request-parameters>false</use-request-parameters>
>         <use-browser-capabilities-db>false</use-browser-capabilities- 
> db>
>         <xslt-processor-role>saxon</xslt-processor-role>
>       </map:transformer>
>     </map:transformers>
>   </map:components>

You can also put this declaration into META-INF/cocoon/avalon which  
keeps your sitemap free of component declarations (example at [1]).


> 5. I created an avalon directory in src/main/resources/META-INF/ 
> cocoon and created a saxon-config.xconf file in it :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <components>
>   <component logger="core.xslt-processor"
>       role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
>       class="org.apache.excalibur.xml.xslt.XSLTProcessorImpl">
>     <parameter name="use-store" value="true"/>
>     <parameter name="incremental-processing" value="false"/>
>     <parameter name="transformer-factory"  
> value="net.sf.saxon.TransformerFactoryImpl"/>
>   </component>
> </components>

It is better to use org.apache.cocoon.components.xslt.TraxProcessor as  
class instead of org.apache.excalibur.xml.xslt.XSLTProcessorImpl.  
TraxProcessor is an adaptation of Excalibur's XSLTProcessor  
implementation to allow better error reporting [2]. The built-in XSLT  
transformers of Cocoon 2.2 also use TraxProcessor [3].


> 6. I added the saxon dependency in the pom.xml
>
>     <dependency>
>       <groupId>net.sf.saxon</groupId>
>       <artifactId>saxon</artifactId>
>       <version>8.7</version>
>     </dependency>

It is even possible to create a saxon-transformer block which contains  
3, 5 and 6 and use it from other blocks where you need Saxon. Then you  
just have to add the saxon-transformer block as a dependency in the  
pom.xml and you can use Saxon right away in your project.

Alex

[1] http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf
[2] http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/components/xslt/TraxProcessor.java
[3] http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/resources/META-INF/cocoon/avalon/cocoon-core-xslt-xalan.xconf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message