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"?>
    <component role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
        <parameter name="use-store" value="true"/>
        <parameter name="transformer-factory"

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'

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to