Skip Headers

Oracle XML Publisher Enterprise User's Guide
Release 5.6.2
Part Number B25951-01
Go to Table of Contents
Contents
Go to previous page
Previous
Go to next page
Next

XSL, SQL, and XSL-FO Support

Extended SQL and XSL Functions

XML Publisher has extended a set of SQL and XSL functions for use in RTF templates. The syntax for these extended functions is

<?xdofx:expression?>

for extended SQL functions or

<?xdoxslt:expression?>

for extended XSL functions.

The supported functions are shown in the following table:

SQL Statement Usage Description
2+3 <?xdofx:2+3?> Addition
2-3 <?xdofx:2-3?> Subtraction
2*3 <?xdofx:2*3?> Multiplication
2/3 <?xdofx:2/3?> Division
2**3 <?xdofx:2**3?> Exponential
3||2 <?xdofx:3||2?> Concatenation
lpad('aaa',10,'.') <?xdofx:lpad('aaa',10,'.')?> The lpad function pads the left side of a string with a specific set of characters. The syntax for the lpad function is:
lpad(string1,padded_length,[pad_string])
string1 is the string to pad characters to (the left-hand side).
padded_length is the number of characters to return.
pad_string is the string that will be padded to the left-hand side of string1 .
rpad('aaa',10,'.') <?xdofx:rpad('aaa',10,'.')?> The rpad function pads the right side of a string with a specific set of characters.
The syntax for the rpad function is:
rpad(string1,padded_length,[pad_string]).
string1 is the string to pad characters to (the right-hand side).
padded_length is the number of characters to return.
pad_string is the string that will be padded to the right-hand side of string1
decode('xxx','bbb','ccc','xxx','ddd') <?xdofx:decode('xxx','bbb','ccc','xxx','ddd')?> The decode function has the functionality of an IF-THEN-ELSE statement. The syntax for the decode function is:
decode(expression, search, result [,search, result]...[, default])
expression is the value to compare.
search is the value that is compared against expression.
result is the value returned, if expression is equal to search.
default is returned if no matches are found.
Instr('abcabcabc','a',2) <?xdofx:Instr('abcabcabc','a',2)?> The instr function returns the location of a substring in a string. The syntax for the instr function is:
instr(string1,string2,[start_position],[nth_appearance])
string1 is the string to search.
string2 is the substring to search for in string1.
start_position is the position in string1 where the search will start. The first position in the string is 1. If the start_position is negative, the function counts back start_position number of characters from the end of string1 and then searches towards the beginning of string1.
nth appearance is the nth appearance of string2.
substr('abcdefg',2,3) <?xdofx:substr('abcdefg',2,3)?> The substr function allows you to extract a substring from a string. The syntax for the substr function is:
substr(string, start_position, [length])
string is the source string.
start_position is the position for extraction. The first position in the string is always 1.
length is the number of characters to extract.
replace(name,'John','Jon') <?xdofx:replace(name,'John','Jon')?> The replace function replaces a sequence of characters in a string with another set of characters. The syntax for the replace function is:
replace(string1,string_to_replace,[replacement_string])
string1 is the string to replace a sequence of characters with another set of characters.
string_to_replace is the string that will be searched for in string1.
replacement_string is optional. All occurrences of string_to_replace will be replaced with replacement_string in string1.
to_number('12345') <?xdofx:to_number('12345')?>  
to_char(12345) <?xdofx:to_char(12345)?>  
sysdate() <?xdofx:sysdate()?>  
minimum <?xdoxslt:minimum(ELEMENT_NAME)?> Returns the minimum value of the element in the set.
maximum <?xdoxslt:maximum(ELEMENT_NAME)?> Returns the maximum value of the element in the set.

The following table shows supported combination functions:

SQL Statement Usage
(2+3/4-6*7)/8 <?xdofx:(2+3/4-6*7)/8?>
lpad(substr('1234567890',5,3),10,'^') <?xdofx:lpad(substr('1234567890',5,3),10,'^')?>
decode('a','b','c','d','e','1')||instr('321',1,1) <?xdofx:decode('a','b','c','d','e','1')||instr('321',1,1)?>

XSL Equivalents

The following table lists the XML Publisher simplified syntax with the XSL equivalents.

Supported XSL Elements Description XML Publisher Syntax
<xsl:value-of select= "name"> Placeholder syntax <?name?>
<xsl:apply-templates select="name"> Applies a template rule to the current element's child nodes. <?apply:name?>
<xsl:copy-of select="name"> Creates a copy of the current node. <?copy-of:name?>
<xsl:call-template name="name"> Calls a named template to be inserted into/applied to the current template. <?call:name?>
<xsl:sort select="name"> Sorts a group of data based on an element in the dataset. <?sort:name?>
<xsl:for-each select="name"> Loops through the rows of data of a group, used to generate tabular output. <?for-each:name?>
<xsl:choose> Used in conjunction with when and otherwise to express multiple conditional tests. <?choose?>
<xsl:when test="exp"> Used in conjunction with choose and otherwise to express multiple conditional tests <?when:expression?>
<xsl:otherwise> Used in conjunction with choose and when to express multiple conditional tests <?otherwise?>
<xsl:if test="exp"> Used for conditional formatting. <?if:expression?>
<xsl:template name="name"> Template declaration <?template:name?>
<xsl:variable name="name"> Local or global variable declaration <?variable:name?>
<xsl:import href="url"> Import the contents of one stylesheet into another <?import:url?>
<xsl:include href="url"> Include one stylesheet in another <?include:url?>
<xsl:stylesheet xmlns:x="url"> Define the root element of a stylesheet <?namespace:x=url?>

Using FO Elements

You can use most FO elements in an RTF template inside the Microsoft Word form fields. The following FO elements have been extended for use with XML Publisher RTF templates. The XML Publisher syntax can be used with either RTF template method.

The full list of FO elements supported by XML Publisher can be found in the Appendix: Supported XSL-FO Elements.

FO Element XML Publisher Syntax
<fo:page-number-citation ref-id="id"> <?fo:page-number-citation:id?>
<fo:page-number> <?fo:page-number?>
<fo:ANY NAME WITHOUT ATTRIBUTE> <?fo:ANY NAME WITHOUT ATTRIBUTE?>