After enumerating all the ways that don't work, I think I have this figured out.
(I'm trying to wrap Saxon's TransformerFactoryImpl so that I can configure it with our own Java function implementations as Saxon Integrated Extension Function classes.) XSLTProcessor *must* be defined Avalon-style. I couldn't find a way to get it properly initialized using Spring XML configuration. <?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="org.dspace.saxon.ConfigurableTransformerFactory"/> </component> </components> I define the bean in Spring XML, since I like that better. The bean definition may not be needed at all -- couldn't find detailed documentation for Avalon/Excalibur configuration. I put it in prototype scope because I couldn't find anything to say whether the Saxon class I'm extending has per-instance state. <!-- Configure a Saxon-based transformer factory for Cocoon. This will be injected Avalon-style since nothing else works. --> <bean class='org.dspace.saxon.ConfigurableTransformerFactory' scope='prototype'/> I could find no way to use Avalon-style configuration to inject a list/set/array as a parameter. Cocoon's Avalon bridge seems to prevent any kind of Spring DI taking place, despite (I am told) using Spring internally -- @PostConstruct didn't work, @Inject didn't work, <constructor-argument> didn't work (by making my class invisible to the bridge). So I added a list-valued property to our own application's configuration file, composed of class names, and instantiate them in the wrapper's constructor. I found it helpful to enable DEBUG logging for the packages org.apache.cocoon.spring.configurator and org.apache.cocoon.core.container.spring.avalon. At last I see Saxon successfully calling my functions when referenced by transforms fed to the Cocoon XSLT transformer! -- Mark H. Wood Lead Technology Analyst University Library Indiana University - Purdue University Indianapolis 755 W. Michigan Street Indianapolis, IN 46202 317-274-0749 www.ulib.iupui.edu
signature.asc
Description: PGP signature