4

The following XPath functions seem not be supported in WSO2 ESB 4.8.1:

  • escape-html-uri()
  • iri-to-uri()
  • encode-for-uri()

Does anyone know what XPath functions are supported and what are not supported in WSO2 ESB 4.8.1?

tuan
  • 433
  • 8
  • 17

2 Answers2

8

XPath 2.0 is supported in WSO2 ESB from version 4.5.0 onwards. It's disabled by default, so you need to do the following to enable it.

  • Open $ESB_HOME/repository/conf/synapse.properties

  • Uncomment the following line,

    synapse.xpath.dom.failover.enabled=true

To access properties in a proxy service, you need to use the prefix syn.

ex.

<property expression="syn:get-property('myProperty')" name="getMyProperty" scope="default" type="STRING"/>
Community
  • 1
  • 1
Kasun Gajasinghe
  • 2,735
  • 1
  • 21
  • 30
2

As far as I can tell from the JavaDocs, the synapse XPath implementation is built on Jaxen, which is XPath version 1.0 only. Therefore none of those functions will be supported, you only have the very limited function library of XPath 1.0 plus the synapse-specific get-property extension.

Ian Roberts
  • 120,891
  • 16
  • 170
  • 183
  • Thanks Ian. Yes, it seems that very limited XPath 1.0 functions are supported. And fn:translate() function in XPath 1.0 is not well-supported either. – tuan Apr 30 '14 at 11:31
  • @tuan try it without the `fn:` prefix - the whole `http://www.w3.org/2005/xpath-functions` namespace is an XPath 2.0 thing, the 1.0 core functions are not in a namespace. I suggest you make doubly sure that whatever documentation or tutorial you're working from is definitely talking about 1.0 rather than 2.0. In particular this is something w3schools is notoriously bad at... – Ian Roberts Apr 30 '14 at 11:46
  • Thanks Ian. I successfully used fn:concat() function. fn:translate() function did get executed however it returned an unexpected result. Anyway, due to limited support of XPath functions, I ended up using Javascript to perform some mediation logic I needed. That worked perfectly. – tuan Apr 30 '14 at 14:01