Oracle Service Bus : Using custom xpath functions in xslt

One of the readers of my blog post ‘Oracle Service Bus 11g, Using Custom Xpath Functions asked we can reuse the custom xpath functions in a xsl transformation.

It’s possibel to reuse the jar and calll the custom functions from within a xsl transformation.

Starting with creating the resources needed for the custom xpath function :

  1. XML Configuration file (osb-custom.xml)
  2. Property file (optional,
  3. Custom Function Class (jar package)

Restart the osb service so the new jar will get loaded.

– Create a new osb project
– Create a new xslt
[sourcecode language=”xml”]


To be able to call a custom xpath function with the Xalan engine we need to add a new namespace_prefix + definition the the xsl
[sourcecode language=”xml”]

– Start with xalan://
– Then the java package + classname, nl.xenta.osb.custom.functions.OsbUtils
– In the select of the value-of we eventually use the namespace-prefix + java method interface to call the java method, cust:customConcat($param1,$param2)

Create a new proxy service and use the xsl in for example an assing activity.
Deploy the service and use the testconsole to test it.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

3 Responses to “Oracle Service Bus : Using custom xpath functions in xslt”


Thanks Eric! This is really a life saver.


Just to share some of my experience regarding reusable xpath functions.
In WSO2 ESB we can use java-script (script mediator) to define reusable funcions which enclose xpath functions or simple way is to make a reusable sequence which has the xpath logic in it.

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>