How can I convert an XSLT transformation into a flow service?
I wouldn’t advocate your doing this. XSLT provides a powerful way of transforming XML and depending on the complexity of the XSLT file, converting it to Flow would take time, and be difficult to maintain.
In the past I generally have written flows to convert one canonical form into another. However I have occasion where the transformation is so complicated that it was easier to convert into XML and write a stylesheet rather than have a complex flow with multiple nested loops and maps.
Integation Server supports XSLT and you have XSLT services.
@Stuart: I understand your concerns.
My customer insists on using flow code for two reasons:
- Performance. Flow outperforms XSLT by a healthy margin (according to their own tests).
- Maintainability. It is difficult for the webMethods developers to work with XSLT since the whole transformation will correspond to one step in the debugger. It will be a black box do it all operation to the webMethods developers.
And, I’m not really looking for a “this is how you can transform XSLT to flow that works if you’re lucky” approach. It must be a proven approach and tool.
It is interesting to hear that the performance of Flow is better than XSLT. I think that would greatly depend on the complexity of the transformation in hand. For XSLT I’ve used an external transformation engine rather than the inbuild one to get more flexability (e.g. to support xs:include), but it can make things more difficult to maintain.
Personnally, it is very easy for a flow to get unreadable and unmaintainable if there are lots of nesting loops and maps mixed with transformation services. The other thing is that XSLT offers a rich set of functions, and XPath references which would be very difficult and complicated to implement in Flow. E.g. try this is one line of flow:-
hours-from-dateTime(substring(normalise-space(string(/x/y/z)), 1, 22))
So, I would be amazed to see the existance of such a tool.
I am an advocate of keeping it simple, and maybe there is some mileage of converting some of the more simpler XSLTs into Flow (which would have to be done by hand) if a beneficial performance increase will result from it. For more complicated stylseheets, I would suggest keeping them as is.
Thanks Stuart. I hear you.
However, your answer doesn’t help me since my hands are tied.
I need to find a way to convert XSLT into Flow
A difficult one for sure. A tool won’t exist unless by pure chance someone has had to do this as well. If you consider this: can I convert XSLT into Java code (for performance purposes), and the answer will be no (not that I can find). So there are only two clear choices:-
- Hand convert each individual XSLT into Flow. This is going to be the fastest route.
- Develop a tool for converting XSLT into Flow language. This will take some considerable effort considering you need to have something that is capable of dealing with XPath expressions, references and XPath functions.
Another consideration for you: you would also need to convert the input and output XML formats into Document canonicals too.
I think you need to coach the customer: is this conversion really worth the huge effort?
None of the alternatives you list will suffice for my customer. If those alternatives are indeed the only ones available, then this XSLT to Flow conversion will not happen. It will not be difficult to convince my customer of that.