cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Desvé" <sylvain.de...@gmail.com>
Subject Re: Setting up Saxon in a Maven built Cocoon application
Date Fri, 20 Jun 2008 18:48:26 GMT
RESOLVED
I finally managed to do it. For those who encounter the same problem, here's
what I did.

1. I followed the tutorial at cocoon.apache.org abd created a block using
maven
2. I created a source XML file and a XSLT 2.0 file
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>

4. I edited sitemap.xmap to add the pipeline

<map:pipeline>
  <map:match pattern="test">
    <map:generate src="test/mySource.xml" type="file" />
    <map:transform src="style/myStyle.xslt" type="xslt-saxon" />
    <map:serialize type="html" />
  </map:match>
</map:pipeline>

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>

6. I added the saxon dependency in the pom.xml

    <dependency>
      <groupId>net.sf.saxon</groupId>
      <artifactId>saxon</artifactId>
      <version>8.7</version>
    </dependency>

7. I ran mvn jetty:run and got to http://localhost:8888/myBlock1/test and
voilà !

That's it !

2008/6/20 Sylvain Desvé <sylvain.desve@gmail.com>:

> I tried it. My sitemap.xmap looks like the following :
> <map:sitemap ...>
>
>   <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>
>
>   <map:pipelines>
>     <map:pipeline>
>       <map:match pattern="forms/*">
>         <map:generate src="forms/{1}.xml" type="file" />
>         <map:transform src="transformers/form2html.xslt" type="xslt-saxon"
> />
>         <map:serialize type="html" />
>       </map:match>
>     </map:pipeline>
>
>     ...
>
>   </map:pipelines>
>
> </map:sitemap>
>
> But when I run mvn jetty:run and request the pipeline I get an error. There
> is a full backtrace of it but the root cause is :
> org.apache.avalon.framework.service.ServiceException: Component with
> 'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' is not defined in this
> service manager. (Key='AvalonServiceManager')
>
> 2008/6/20 Johannes Hoechstaedter <j.hoechstaedter@memocomp.de>:
>
> Hi Sylvian,
>>
>> have you tried to add the component to your sitemap.xmap?
>>
>> cheers
>>
>> Sylvain Desvé schrieb:
>>
>>> Hi,
>>>
>>> I followed the tutorials at http://cocoon.apache.org/1370_1_1.html to
>>> create my first Cocoon application. It worked fine.
>>>
>>> But now I need to use Saxon instead of Xalan because my XSLT files are
>>> using XSLT 2.0 features. I found how to do that at
>>> http://wiki.apache.org/cocoon/Saxon
>>>
>>> It explains that I need to add the Saxon component to the cocoon.xconf.
>>> The problem is I don't have a cocoon.xconf file anywhere in my Maven built
>>> project.
>>>
>>> Can someone explain me how I can do that ?
>>>
>>> Thanks,
>>> Sylvain
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>

Mime
View raw message