Creating an RTF Template 2-95
Advanced Report Layouts
It is a common requirement to print a batch of documents, such as invoices or purchase
orders in a single PDF file. Because these documents are intended for different
customers, each document will require that the page numbering be reset and that page
totals are specific to the document. If the header and footer display fields from the data
(such as customer name) these will have to be reset as well.
XML Publisher supports this requirement through the use of a context command. This
command allows you to define elements of your report to a specific section. When the
section changes, these elements are reset.
The following example demonstrates how to reset the header and footer and page
numbering within an output file:
The following XML sample is a report that contains multiple invoices:
<BILL_CUST_NAME>Vision, Inc. </BILL_CUST_NAME>
<BILL_CUST_NAME>Oracle, Inc. </BILL_CUST_NAME>
Each G_INVOICE element contains an invoice for a potentially different customer. To
instruct XML Publisher to start a new section for each occurrence of the G_INVOICE
element, add the @section command to the opening for-each statement for the group,
using the following syntax:
where group_name is the name of the element for which you want to begin a new
For example, the for-each grouping statement for this example will be as follows:
The closing <?end for-each?> tag is not changed.
The following figure shows a sample template. Note that the G_INVOICE group
for-each declaration is still within the body of the report, even though the headers will
be reset by the command.