75% found this document useful (4 votes)
3K views2 pages

Cheatsheet BI Publisher

This document provides a summary of common template tags used in BI Publisher templates to format and manipulate data. It lists tags for: - Inserting element values and declaring namespaces - Conditional and repeating structures like if/else, for-each, sort - Grouping and iterating over groups - Setting variables, parameters, formatting numbers and dates - Page totals and regions, splitting columns dynamically - Templates and calling/applying other templates - Extended functions for manipulating strings and numbers

Uploaded by

Subba Reddy N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
3K views2 pages

Cheatsheet BI Publisher

This document provides a summary of common template tags used in BI Publisher templates to format and manipulate data. It lists tags for: - Inserting element values and declaring namespaces - Conditional and repeating structures like if/else, for-each, sort - Grouping and iterating over groups - Setting variables, parameters, formatting numbers and dates - Page totals and regions, splitting columns dynamically - Templates and calling/applying other templates - Extended functions for manipulating strings and numbers

Uploaded by

Subba Reddy N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Keiths Cheat Sheets

BI Publisher Templates

Common Template Tags


<?element@inline?>
Insert the value of the first element relative to the current loc.
XSLT Equivalent

<xsl:value-of select=".//element[1]"/>
Examples

<?EMPLID?>

<?UNT_TRNSFR + TRF_TAKEN_GPA?>

<?namespace@begin:prefix=url?>
Declare a namespace so that it can be used to access elements.
Examples

<?namespace:ua=http://arizona.edu?><?ua:EMPLID?>

<?if@block:condition?> <?end if?>


Conditionally include wrapped content where condition is a BIP
expression which can also include XSLT 1.0 functions, XPATH 1.0
expressions and BIP extended functions.
XSLT Equivalent

<xsl:if test="condition"> </xsl:if>


Examples

<?if:PRINT_FLAG="Y"?>A block paragraph.<?end if?>


<?if@inlines:DESCR<>""?><?DESCR?><?end if?>

<?for-each@block:element?><?end for-each?>
Cycle through all of the matching elements.
XSLT Equivalent

<xsl:for-each select=".//element"></xsl:for-each>
Examples

<?for-each:ACAD_PROG?> <?end for-each?>


<?for-each@inlines:CMNT?><?CMNT?> <?end for-each?>

<?sort@incontext:element;'order';'type'?>
Paired with <?for-each?>, sort the data by element, with the
contents treated as type (text or number), ordered by order
(ascending or descending).
XSLT Equivalent

<xsl:sort select=".//element" order="order"


data-type="type" />
Examples

<?for-each:ACAD_PROG?><?sort:SEQ_NBR?>

<?for-each-group@block:element;group?>
<?end for-each-group?>
Cycle through all of the matching elements, but only repeat the
loop once when the group element value changes.
XSLT Equivalent

<xsl:for-each-group select=".//element"
group-by="group"> </xsl:for-each>
Examples

<?for-each-group:ACAD_PLAN;ACAD_PROG?>
<?ACAD_PROG?>

<?for-each@block:current-group()?>
Paired with <?for-each-group?>, cycle through just the elements
that share the current group value.
XSLT Equivalent

<xsl:for-each select="current-group()">
Examples

<?for-each@inlines:current-group()?><?ACAD_PLAN?>
Keiths Cheat Sheets

BI Publisher Templates
<?choose@block:current-group()?>
<?when:expression?> <?end when?>
<?otherwise:?> <?end otherwise?>
<?end choose?>
Conditionally include the first true when expression content, or
the optional otherwise content.

Variable & Parameter Template Tags


<?xdoxslt:set_variable($_XDOCTX,'var',val)?>
Set a BIP variable named var, with the value val.
<?xdoxslt:get_variable($_XDOCTX,'var')?>
Get a BIP variable named var.

v1.0 (Jun 14)

Page Total Template Tags


Although designed for running totals of amounts, these can be used for any totals.

<?add-page-total:name;'element'?>
Add the numeric value of element to the total variable name, for
this page only. Typically used when the element is displayed.
Examples

<?UNITS?><?add-page-total:totalUnits;'UNITS'?>

<?show-page-total:name;'format'?> see format-number


Display the current page total stored in name. This displays the
full total regardless where it appears on the page, inc. headers.
Examples

<?show-page-total:totalUnits;'999D99'?>
For special template tags for carried-forward and brought-forward usage, see the
full BI Publisher documentation.

Page Region & Page Number Template Tags

Examples

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

<?param@begin:name;[default]?>
Define and optionally set the default value of parameter name.
The parameter is then accessed using the variable syntax $name.
<?variable@begin:name;'value'?>
Define and set the XSLT variable name to the given value.

Formatting Template Tags


<?attribute@inline:name;'value'?>
Set the XSL-FO formatting attribute name, to the give value.
<?format-number:element;'format'?>
Display the value of element, which must be a valid number,
formatted using the following formatting rules:
0 or 9
A digit, where 0's are padded, 9's are not.
C or L
Currency symbol or Local currency symbol.
G or D or S Thousands Grouping (,), or Decimal (.) separators, or Sign (+).
MI or PR or PT
Negatives are trailing, brackets <> or parenthesis ().
Examples

<?format-number:GPA;'0D000'?>

<?format-date:element;'format';['timezone']?>
Display the value of element, which must be a valid date or
date/time, formatted using the following rules: (common only)
YYYY or YY or CC
Year as 4-digit or 2-digit or century 2-digit.
MM
Month as 2-digit.
MON or MONTH
Month name abbreviated or full padded to 9 chars.
D or DD or DDD Day of week (7), day of month (31) or day of year (366).
DY or DAY
Day name abbreviated or full padded to 9 chars.
HH or HH12 or HH24
Hour am/pm (two forms) or 24-hour.
MI or SS of FF(1..9)
Minutes or seconds or fractional second (digits).
AM or A.M. or PM or P.M.
AM/PM indicator with or without periods.
LONG or MEDIUM or SHORT
Abstract date only formats.
LONG_TIME or MEDIUM_TIME or SHORT_TIME
Abstract date/time.
Examples

<?format-date:DTTM;'DD/MM/YYYY HH:MI PM'?>


BI Publisher Templates

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


Define a region as the body of the report, which implicitly defines
the header as any preceding content, and the footer following.
Can be repeated, such as with special context @last-page/@lastpage-first, after a section break, with last header & footer too.
Examples

Header region.
<?start:body?>Body region.<?end body?>
Footer region.
==============Section Break==============
<?start@last-page:body?>Notes.<?end body?>

<?split-by-page-break:?>
Insert a page break. Typically used in a repeating group.
Examples

<?split-by-page-break:?><end for-each?>

<?initial-page-number:page|'auto'?>
Set the page number, or prevent restarting after a section break.
Examples

<?for-each-group:EMPLID;CAREER?>
<?initial-page-number:1?>

<?section:force-page-count;'type'?>
Create pages as necessary to end the report of the correct
number of pages according to type which may be 'end-on-evenlayout', 'end-on-odd-layout', 'end-on-even' or 'end-on-odd'.
<?copy-to-bookmark:?>
{Microsoft Word table of contents}
<?end copy-to-bookmark?>
Create PDF bookmarks from a previously generated Word table
of contents. Both the table of contents and bookmarks remain.
<?convert-to-bookmark:?>
{Microsoft Word table of contents}
<?end convert-to-bookmark?>
Create PDF bookmarks from a previously generated Word table
of contents. Only the bookmarks remain, the table is discarded.
v1.0 (Jun 14)

Keiths Cheat Sheets

BI Publisher Templates

Dynamic Table Column Template Tags

Templates & Sub-Templates

<?split-column-header@column:element?>
Used in a column heading to define a dynamic (cross-tab) column
which is duplicated for each value of element. Pair with below.

<?template@end:name?>
Define a named template. The content will only be included
when called directly or matched by applying templates.

<?split-column-date@cell:element?>
Used in a column cell to define a dynamic (cross-tab) column
which is duplicated for each value of element. Pair with above.
<?split-column-width:width?>
Optionally used with above, to define the column width. Unless a
unit is specified, the width is considered a part of the total width.
<?split-column-width-unit:multiplier?>
Optionally used with above, to define a multiplier which causes
the width to be converted to an absolute value in points (1/72").
<?horizontal-break-table:columns?>
Optionally used with above, to set a fix number of key columns to
repeat when dynamic columns repeat onto more than one page.

Context Qualifiers

XSLT Equivalent

<xsl:template name="name"/>

<?call@inblock:name?>
Call a template which will include all of its content.
XSLT Equivalent

<xsl:call-template name="name"/>

<?apply@inline:elements?>
Call any templates which match any of the elements selected.
This will only match XSLT defined templates, not BIP templates.
XSLT Equivalent

<xsl:apply-templates select="elements"/>

<?import@begin:url?>
Import an XSLT or RTF file which should contain only template
definitions. During testing this will be like "file:///U:/filepath.rtf",
on the server this will be like "psxmlp://CONTENT_ID".

Used as <?tag@context:?> or <xsl:tag xdofo:ctx="context">

Extended Functions

@section
Tag affects or creates an entire section, including the header and
footer. Typically used with <?for-each@section:?>.

Prefixed xdofx: which mimic SQL equivalents, and xdoxslt: which extend XSLT.

@column
Tag affects an entire table column. Typically used with
<?if@column:?> to hide/show an entire column.
@cell
Tag affects just the cell of a table. Typically used in combination
with @column to create dynamic columns.
@block
Tag affects an entire block of text, such as a Word paragraph or a
table cell. This is the default context for many tags. fo:block
@inblock
Tag is a single statement within a block.
@inlines
Tag affects consecutive smaller inline statements forming a string
of text. Typically used with <?if@inlines:?>.

<?xdoxslt:abs(number)?>
Return the absolute value of number.

v1.0 (Jun 14)

<?xdoxslt:left('str',length)?>
Return just the first length characters of string str.

use also right()

<?xdofx:length('str')?>
Return the length of the string str in characters.

use also upper()

<?xdofx:lower('str')?>
Convert all uppercase characters in str to lowercase.

use also upper()

<?xdofx:lpad('str',length,'char')?> use also rpad()


Pad left the string str, to length chars, using character char.
<?xdoxslt:minimum(elements)?>
use also maximum()
Return the minimum value of all elements in the set.
Examples

<?xdofx:minimum(../BEGIN_DT)?>

<?xdoxslt:next_element(current-group(),.,
'element')?>
use also prev_element()
Return the relative next element in the current group.
<?xdofx:replace('str','from',['to'])?>
Replace any and all occurrences of from, with to, in the string str.
<?xdoxslt:replicate('str',repeat)?>
Replicate the string str by repeat times, concatenated.
<?xdofx:round(number,[places])?> also xdoxslt:round()
Round number to the given number of places or zero.

<?xdofx:ceil(number)?>
use also floor()
Return the smallest integer greater than or equal to number.

<?xdoxslt:sec_diff('datetime1','datetime2',
$_XDOLOCALE,$_XDOTIMEZONE)?>
Calculate the difference in seconds between datetime1 and
datetime2, where both date/times must be in the format
'yyyy-mm-ddThh:mm:ss'.

<?xdofx:decode('str','case','res',['othr'])
Search for a match between str and any case string, then return
the result res. If no match is found, the result othr is returned.

<?xdoxslt:set_array($_XDOCTX,'array',index,
'value')?>
use also get_array()
Store in the named array, at the index, the given value.

<?xdofx:chr(ascii)?>
Return the character for the ascii value.

Examples

<?xdofx:decode(FLAG,'A','Active','I','Inactive')?>

<?xdoxslt:date_diff('units','date1','date2',
$_XDOLOCALE,$_XDOTIMEZONE)?>
Calculate the difference between date1 and date2, where both
dates must be in the format 'yyyy-mm-dd', and where the result
is in units: y, m, w, d, h, mi, s, ms

<?xdofx:substr('str',start,length)?>
Extract the substring of str, from start, for length characters.
<?xdofx:sysdate()?>
Returns the current system date/time.
<?xdoxslt:trim('str')?>
use also ltrim() & rtrim()
Trim both leading and trailing spaces from string str.

@inline
Tag is a single statement. fo:inline

<?xdoxslt:get_day('date',$_XDOLOCALE)?>
Extract just the day part of a date which must be in the format
'yyyy-mm-dd'. Similarly use get_month() and get_year().

<?xdoxslt:truncate(number,[places])?>
Truncate the number to the given decimal places, where places
can be negative, and places defaults to zero.

@incontext
Tag is inserted immediately after the surrounding tags, such as
with <?sort:?>.

<?xdofx:greatest(item1,[item2,])?> use also least()


Return the greatest of all items, all are treated as type of item1.

Embedded Image XSL-FO Elements

@begin or @end
Tag is placed at the beginning/end of the XSLT stylesheet. Begin
context is applied to <xsl:variable> tags unless overridden.
Keiths Cheat Sheets

<?xdofx:instr('str','srch',[start],[nth])
Return the position of the nth occurrence of srch within str,
starting at start, which can be negative to reverse the search.
BI Publisher Templates

<fo:instream-foreign-object content-type="image/?"
height="h px|in|cm|%" width="w px|in|cm|%">
<xsl:value-of select="BASE64" />
</fo:instream-foreign-object>
Image types supported are "image/gif", "image/jpg" and "image/png"

v1.0 (Jun 14)

You might also like