Write a Custom XPath Function Class
You create the function as a Java class that extends com.jackbe.presto.mashup.EMMLUserFunction. See Presto Custom XPath API for reference information on this class.
Note: | In earlier Presto releases, this API was the com.jackbe.jbp.jems.client.EMMLUserFunction class. Any method in your custom class can be used as an XPath function with these limitations: |
The method must be a static class method.
All parameters for the method must be simple types.
The return type can be
void or any simple type. It cannot return a node or node set.
For example:
package com.mycompany.mashups;
import com.jackbe.presto.mashup.EMMLUserFunction;
public class CustomFunctions extends EMMLUserFunction {
public static boolean soundex(String name, String pattern){
org.apache.commons.codec.language.Soundex s = new;
return s.encode(name).equalsIgnoreCase(s.encode(pattern));
}
}
You must add the following JARs to the classpath to compile your custom XPath Function class:
web-apps-home/presto/WEB-INF/lib/emml.jar web-apps-home/presto/WEB-INF/lib/presto-api.jar web-apps-home/presto/WEB-INF/lib/saxon8.jar