Tuesday, August 21, 2007

Using BPELs doXslTransform() function

As a improvement to my previous design of aggregating RSS feeds from various continuous integration systems, I wanted to do a simple XSL transform to make my post-processing easier. If I could get each element to be on it's own line, then things become much easier for the later parsing that I have to do.

Given that I am using OpenESB and JBI to accomplish my goals, I have two choices of how to perform the transform. 1) Use the XSLTSE or 2) Use the BPEL function doXslTransform(). I choose the latter option because it was the simplest thing that worked. (I will have another post about using the XSLTSE though. Stay tuned!)

To start, I created the XSL stylesheet that takes input and produces output that validated to the same schema (rssbcext.xsd in this case). Then in my Netbeans BPEL editor, I clicked on the Assign1 operation.



This brings up the BPEL Mapper. Add the doXslTranform functoid (and no, I did not come up with that term).



The Netbeans tooling is not yet complete for this function, so we have to add the stylesheet file-name as a URN string literal. In my case it was 'urn:stylesheet:citransform.xsl'. Drag the RSSConsumerWSDLOperationIn.part1 to the node-set and drag the return-node to the FileWSDLOperationIn.part1.

Clean and Build, then deploy to Glassfish. That's all there is to it. My RSS feeds are now in a compact format, making my processing easier and saving valuable disk space. :)

2 comments:

Phillip Anderson said...

Used your blog as an example for a transformation I was doing. I ran into one issue on the URN for the stylesheet. I found that it should read as follows: 'urn:stylesheets:file.xsl'. The difference is the 's' in stylesheets. Other than that difference everything went great and your blog was very helpful.

Ilango said...

I found your tutorial informative. I would like to transform an XML structure shown below
outermost

inner minOccurs="1" maxOccurs="unbounded"
element1/
element2/
element3/
/inner
/outermost

What form of XML can the final output take as far as this structure and what can the transformer.xsl for this structure be?

thanks