• Post category:BI Publisher
  • Post comments:0 Comments
  • Post last modified:July 4, 2023
  • Reading time:9 mins read
You are currently viewing 40 Important functions that can be used with XML tags in RTF

In this article, let’s look into different XML tags that can be used in RTF template to achieve the required functionality.

1) Define the Header somewhere on the page as per requirement. (call header )

<?Call:header?>
<?template: header?>
<?end template?>

2) For body Contents

<?start:body?>
<?end body?>

3)Last Page Only Content:
Insert the following syntax on the final page:

<?start@last-page:body?>
<?end body?>

4) Sort (Data sorting)

<?sort:trx_number?>
Sort descending
<?sort:trx_number;data-type='number';order='descending'?>

5) Arithmetic Calculated Fields:

<?field1 + field2?>
<?field1 – field2?>
<?field1 * field2?>
<?field1 / field2?>

6) Dynamic data columns:

Dynamic Column Header
<?split-column-header:group element name?>
Dynamic Column Data
<?split-column-data:group element name?>

7)Rows per page:

Define row counter variable in a form field
<?xdoxslt:set_variable($_XDOCTX, 'Counter', 0)?>

Increment counter for each line (again in a form field)
<?xdoxslt:set_variable($_XDOCTX, 'Counter', xdoxslt:
get_variable($_XDOCTX, 'Counter') + 1)?>

Break if the number of rows is reached (say 10 rows in this example)
<?if: xdoxslt:get_variable($_XDOCTX, 'Counter') mod 10=0?>
<?split-by-page-break:?>
<?end if?

8)Re-grouping XML Data: Not limited by the structure of the data source

Use the tags
<?for-each-group: BASE-GROUP;GROUPING-ELEMENT?>
<?end for-each-group?>

Can establish nested groupings
<?for-each:current-group(); GROUPING-ELEMENT?>
<?end for-each-group?>


9) Concatenation Function

<?xdofx:3||2?>

10) rpad function

<?xdofx:rpad('aaa',10,'.')?>

11) trim function

<?xdoxslt:trim(' a ')?>

12) ltrim function

<?xdoxslt:ltrim(' a ')?>

13) rtrim function

<?xdoxslt:rtrim(' a ')?>

14) decode function

<?xdofx:decode('xxx','bbb','ccc','xxx','ddd')?>

15) Instr function

<?xdofx:Instr('abcabcabc','a',2)?>
instr(string1,string2,[start_position],[nth_appearance])

16) substr function

<?xdofx:substr('abcdefg',2,3)?>

17) left function

<?xdoxslt:left('abcdefg', 3)?>

18) right function

<?xdoxslt:right('abcdefg', 3)?>

19) replace function

<?xdofx:replace(name,'John','Jon')?>
replace(string1,string_to_replace,[replacement_string])

20) to_number function

<?xdofx:to_number('12345')?>

21) sysdate function

<?xdofx:sysdate()?>
<?xdofx:sysdate('dd-mon-yyyy')?>
<?xdofx:sysdate('dd-mm-yyyy')?>
<?xdofx:sysdate('day-dd-month-yyyy')?>

22) lower function

<?xdofx:lower (char)?>

23) upper function

<?xdofx:upper(char)?>

24) length function

<?xdofx:length(char)?>

25) Minimum Function – Returns the minimum value of the element in the set

<?xdoxslt:minimum(ELEMENT_NAME)?>

26) Maximum Function – Returns the maximum value of the element in the set.

<?xdoxslt:maximum(ELEMENT_NAME)?>

27) Copy the Current Node

Use this element to create a copy of the current node.
XSL Syntax: <xsl:copy-of select="name">
BI Publisher Tag: <?copy-of:name?>

28) Call Template

XSL Syntax: <xsl:call-template name="name">
BI Publisher Tag: <?call-template:name?>

Call Template – Template Declaration
XSL Syntax: <xsl:template name="name">
BI Publisher Tag: <?template:name?>

29) Import Stylesheet

XSL Syntax: <xsl:import href="url">
BI Publisher Tag: <?import:url?>

30) Declaring, Assigning, and getting the value of Variables

Declaration - <?xdoxslt:set_variable($_XDOCTX,'variable name', 0)?>

Sets the value of variable_name to the current value plus the element amount
<?xdoxslt:set_variable($_XDOCTX,'variable name', xdoxslt:get_variable($_XDOCTX,'variable name')+element name)?>

Get Value
<?xdoxslt:get_variable($_XDOCTX, 'variable name')?>

31) For loop

<?for-each:XML group element tag name?>
<?end for-each?>

32) If Statement

<?if:boolean_test?>
<?end if?>
Ex:
<?if:LINE_TYPE='LINE' ?>
<?end if?>

33) Rows per page (Examples 6 rows per page)

Define row counter variable in a form field
<?xdoxslt:set_variable($_XDOCTX, 'Counter', 0)?>

Increment counter for each line (again in a form field)
<?xdoxslt:set_variable($_XDOCTX, 'Counter', xdoxslt:get_variable($_XDOCTX, 'Counter') + 1)?>

Break if the number of rows is reached (say 6 rows in this example)
<?if: xdoxslt:get_variable($_XDOCTX, 'Counter') mod 6=0?>
<?split-by-page-break:?>
<?end if?

34) Choose Statements

<?choose:?>
<?when:expression?>
<?otherwise?>

35) To insert the Initial Page number on a different page

Initial Page Number
<?initial-page-number:pagenumber?>

To display contents in last page?
Last Page Only Content
<?start@last-page:body?>
<?end body?>

End on Even or End on Odd Page
<?section:force-page-count;'end-on-even-layout'?>

To end on an even page with layout
<?section:force-page-count;'end-on-even-layout'?>

To end on an odd page layout:
<?section:force-page-count;'end-on-odd-layout'?>

36) Generating Bookmarks in PDF Output

<?copy-to-bookmark:?>
directly above your table of contents and
<?end copy-to-bookmark:?>

37) Drop Down Lists

Conditional Formatting
<?if:VENDOR_NAME='COMPANY A'?>
<?end if?>

38) Displaying Page Totals

<?add-page-total:TotalFieldName;'element'?>
<?show-page-total:TotalFieldName;'Oracle-number-format'?>

39) Sorting

<?sort:xml_tag?>
<?sort:xml_tag1?> <?sort:xml_tag2?><?sort:xml_tag2?>

40) Regrouping

To regroup the data, use the following syntax:
<?for-each-group: BASE-GROUP;GROUPING-ELEMENT?>

Regrouping by an Expression
To establish nested groupings within the already defined group, use the following
<?for-each:current-group(); GROUPING-ELEMENT?>
Using Variables