Tuesday, 8 July 2008

BIP XSL-TEXT Templates : Part 2

Not much changes in Birmingham.

It seems like an eternity ago that I was at university there - but after only a couple of hours and a fine Balti in a BYOB restaurant, I felt like I'd never left.

Anyway, enough of my weekend! Let's get back to XSL-TEXT templates.

Excluding XSL-FO, there are 3 different types of XSLT script templates available in BI Publisher. These are currently not greatly documented in the BIP User Guide. However, the difference between them is the format of the output created by the XSLT script i.e.:

XSL-HTMLA XSLT script to transform an XML document into a HTML file
XSL-XMLA XSLT script to transform an XML document into another XML document
XSL-TEXTA XSLT script to transform an XML document into a TEXT file


Note: The XSL element used to set the output type is:



Generally, it is a lot simpler to use an RTF or eText template to create the report layout - and I would ALWAYS recommend using an RTF or eText template where possible for this reason.

However, there comes a time when it may be easier to write XSL and XPATH directly rather than live with any shortcomings of the RTF or eText template type.

One such example of this is to add blank lines and additional formatting logic into eText templates.

In a previous blog on R12 Payments and eText templates, I built the following text file using an eText template:



Here is a XSL-TEXT template to build the same text file using the same R12 Payments XML data source:



A simple XSLT example... however, the point is that I can reference any XSL element, XPATH or extended SQL function directly. I have complete control over the layout of the text file being created.

Here are the source files:

Sample XML Data File
XSL-TEXT template

I built and tested this example using the BIP Enterprise Server (but this works equally well from Oracle E-Business Suite.)

To test this example using the BIP Server:

1) Create a new report and register the XML file as a data source:



2) Upload the XSL-TEXT layout template:



3) View the final transformed output:

3 comments:

Kiantosca said...

Kevin -
This is great info! Can I ask a question as an XML rookie? I have the Standard Check format template that I'm modifying in R12. Looking at the .rtf file, there is a field for Customer Number, but in the .xml source I'm finding (your sample file, files from my instance), there is no Customer Number. The field does print on the check. My problem: I am looking for the Customer Number field on the SITE level (not the Supplier Level as is on the delivered .rtf). My question: Is there another .xml file that is pulling this information that does not seem to be on the .xml files I'm obtaining? Or is there a mapping somewhere that identifies a name of a field as Customer Number but it shows differently on the .xml? Thanks in advance for you help (so much for asking a quick question).

Kate

Unknown said...

You can test XSL-TEXT templates using the command line as well, if you have BI Publisher Desktop installed.

Add all the jar files in C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\TemplateViewer\lib to the CLASSPATH and then use ORAXSL

e.g.

oraxsl data.xml template.xsl output.txt

Anonymous said...

Hi Kevin,

Thanks for sharing this info.. I created a BIP report on Enterprise Edition using the same sample XML data and XSL code u provided here in your blog but I get a blank screen as output. I followed exactly the same steps u've mentioned - create data set and template...Just wondering if I am missing any step?? Could you please help..