You can do it through XSLT . The steps to do it is as following (logically)
Step 1: Determine the criteria based on which you want routing [it could be URI or any part of message] Step 2: Use datapower built in function dp:open-url to send traffic to target.
Step 3: Get the response and process it.
There are other ways to do it as well but this is the most straight forward way.