While I'm a fan of the XML Publisher, I find that anytime I try to get too complex with my RTF template I get myself into trouble. The User Guide provides some examples, but inevitably I want to do something a little different and it just won't come together. It might be that I've got the syntax wrong, it might be that there's a bug in the tool, or it might simply be that it doesn't do that.
However, for my most recent XMLP report, I decided to do some pre-processing of the data with XSLT, so that the xml data the report was built upon looked a lot like the report itself. The challenge of the report was that it required four columns per page, then 1-to-n number of rows for each column. Again, probably doable in the XML Publisher template, but at best it would be fragile.
Instead of trying to do it all within the plug-in tool, I did the heavy lifting in PeopleCode. First I created and populated a rowset with my data; then I used the PeopleTools application package PSXP_XMLGEN:RowSetDS which turns a rowset into an xml string with the method getXMLData; finally I called built-in function TransformEx to run the xml string through an XSL template.
With the transformed xml, creating the XML Publisher report was quick and easy. Now I'm using the XML Publisher to do tasks like formatting and page breaks—things it does very well. It also means the client will be able to make changes to the report template without having to address any complex logic.