377.8. Saxon 확장 기능 사용
Saxon 9.2 이후, write extension functions have been supplemented by a new mechanism, referred to as integrated extension functions you can now easily use camel as shown in the below example:
SimpleRegistry registry = new SimpleRegistry();
registry.put("function1", new MyExtensionFunction1());
registry.put("function2", new MyExtensionFunction2());
CamelContext context = new DefaultCamelContext(registry);
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.to("xslt:org/apache/camel/component/xslt/extensions/extensions.xslt?saxonExtensionFunctions=#function1,#function2");
}
});Spring XML의 경우:
<bean id="function1" class="org.apache.camel.component.xslt.extensions.MyExtensionFunction1"/>
<bean id="function2" class="org.apache.camel.component.xslt.extensions.MyExtensionFunction2"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:extensions"/>
<to uri="xslt:org/apache/camel/component/xslt/extensions/extensions.xslt?saxonExtensionFunctions=#function1,#function2"/>
</route>
</camelContext>