Using Saxon9 for XSLT with Apache Cocoon 2.2

I would like to use Saxon (9HE) to handle XSLT in Apache Cocoon (2.2). I followed the instructions for using Saxon from http://wiki.apache.org/cocoon/Saxon . These instructions describe the process using the .xconf file, which is no longer Cocoon's preferred configuration method (as described in http://cocoon.apache.org/2.2/core-modules/core/2.2/1259_1_1.html ), although this page also notes that the legacy .xconf configuration is still supported.

I tried to put the configuration core.xslt-processorin WEB-INF/cocoon.xconf(as described in the Saxon instructions), in WEB-INF/cocoon/xconf/saxon-xslt.xconf(as described on the Cocoon configuration page linked above) and in META-INF/cocoon/saxon-xslt.xconf. In each case, I get an error message:

org.apache.avalon.framework.service.ServiceException: Component with  \
'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon' is not defined in \ 
this service manager. (Key='AvalonServiceManager')

I placed saxon9he.jarin WEB-INF/liband tried to delete its directory META-INFas described in the Saxon instructions. I reloaded my servlet container (Jetty) for each case.

I am a lover of Java, so maybe I am missing an elementary step. It should also be noted that I use Cocoon in the context of a DSpace system, so it is possible that DSpace is set to ignore my .xconf files.

However, it seems that there should be a way to specify the Saxon processor using Spring config or the .properties file, but I did not find any instructions for this online (they all define the .xconf configuration process).

Any thoughts? Thank!

+4
source share
1 answer

Answering my own question -

Using Saxon with Cocoon XSLT for DSpace

Create the xconf file in [dspace-src]/dspace/modules/xmlui/src/main/resources/META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconfand add the following lines:

<?xml version="1.0" encoding="UTF-8"?> <components> <component role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon" class="org.apache.cocoon.components.xslt.TraxProcessor"> <parameter name="use-store" value="true"/> <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/> </component> </components>

Add the following lines to [dspace-src]/dspace/modules/xmlui/pom.xml(or change with your version of Saxon):

<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.5.1-4</version> </dependency>

Create DSpace with mvn package.

Update your webapps with ant update_webapps(or fresh_installor something else).

[dspace]/webapps/xmlui/sitemap.xmap XSLT xslt-processor-role saxon. : , , .

+2

Source: https://habr.com/ru/post/1532317/


All Articles