You are on page 1of 14

Advanced RTF Template Techniques

XML Publisher

Advanced Features
Template Properties Parameters Updateable Variables Page Break Alias Running Totals If Then Else Conditional Formatting @section, @cell Page Total Carried Forward/Brought Forward

Template Properties
Embed any XML Publisher properties to RTF template Either hard code or reference values in the XML data Use custom document properties dialog Examples

Font embedding, Security settings Prefix XML Publisher property with xdo-
Name: xdo-pdf-open-password Value: welcome


Template Parameters
Pass parameter values into the template at runtime Not yet supported by concurrent manager When calling TemplateHelper/FOProcessor add properties prefixed with xslt. Declare the parameter in the template
<xsl:param name="InvThresh" select="0"/>

Reference value in Template using $ prefix e.g. $InvThresh

Updateable Variables
Ability to set and get variable values Usage Declaring /Setting a variable value
<?xdoxslt:set_variable($_XDOCTX, 'variable_name', value)?>

Retrieving a variable value

<? xdoxslt:get_variable($_XDOCTX, ' variable_name ')?>

Use variables in calculations :

<?xdoxslt:set_variable($_XDOCTX, 'x', xdoxslt:get_variable($_XDOCTX, 'x' + 1)?>

Running Totals
Make use of the updateable variables to create and track the running total inside a foreach loop Use the set and get methods to create and update the necessary variables

If Then Else
Can be used in place of a choose: statement Can nest if-then-else expressions to multiple levels
IF InvoiceAmount = 0 THEN InvoiceAmount ELSE No Value END IF

Conditional Formatting
Conditionally highlight data

Fonts, Background
Cells, Rows


Use xsl attributes to set the formatting

Page Totals
Ability to add page totals to layout Either in header/footer or in body of template Declare the page total first

Show the page total value, specifying the number format to be used

Carried Forward/Brought Forward

Ability to add carried forward/brought forward values to the top and bottom of a page Conditionally show on first and last pages

Section Breaks
Allows you to maintain header information across pages and invoke a page break on a group element Very useful for parent/detail reports e.g. Invoices, Pos, etc