You are on page 1of 2

Keith’s Cheat Sheets BI Publisher Templates v1.

0 (Jun ‘14)

Common Template Tags Page Total Template Tags


<?element@inline?>
BI Publisher Templates Although designed for running totals of amounts, these can be used for any totals.

Insert the value of the first element relative to the current loc. <?choose@block:current-group()?> <?add-page-total:name;'element'?>
XSLT Equivalent <?when:expression?> … <?end when?> Add the numeric value of element to the total variable name, for
<xsl:value-of select=".//element[1]"/> <?otherwise:?> … <?end otherwise?> this page only. Typically used when the element is displayed.
Examples <?end choose?> Examples
<?EMPLID?> <?UNT_TRNSFR + TRF_TAKEN_GPA?> <?UNITS?><?add-page-total:totalUnits;'UNITS'?>
Conditionally include the first true when expression content, or
<?namespace@begin:prefix=url?> the optional otherwise content. <?show-page-total:name;'format'?> see format-number
Declare a namespace so that it can be used to access elements. Display the current page total stored in name. This displays the
Examples Variable & Parameter Template Tags
full total regardless where it appears on the page, inc. headers.
<?namespace:ua=http://arizona.edu?>…<?ua:EMPLID?> Examples
<?xdoxslt:set_variable($_XDOCTX,'var',val)?>
<?if@block:condition?> … <?end if?> Set a BIP variable named var, with the value val. <?show-page-total:totalUnits;'999D99'?>
Conditionally include wrapped content where condition is a BIP For special template tags for carried-forward and brought-forward usage, see the
<?xdoxslt:get_variable($_XDOCTX,'var')?> full BI Publisher documentation.
expression which can also include XSLT 1.0 functions, XPATH 1.0
Get a BIP variable named var.
expressions and BIP extended functions.
XSLT Equivalent
Examples Page Region & Page Number Template Tags
<?xdoxslt:set_variable($_XDOCTX, 'uaCount',
<xsl:if test="condition"> … </xsl:if> xdoxslt:get_variable($_XDOCTX, 'uaCount') + 1)?> <?start:body?> … <?end body?>
Examples
<?if:PRINT_FLAG="Y"?>A block paragraph.<?end if?> Define a region as the body of the report, which implicitly defines
<?param@begin:name;[default]?>
<?if@inlines:DESCR<>""?><?DESCR?><?end if?> the header as any preceding content, and the footer following.
Define and optionally set the default value of parameter name.
Can be repeated, such as with special context @last-page/@last-
<?for-each@block:element?>…<?end for-each?> The parameter is then accessed using the variable syntax $name.
page-first, after a section break, with last header & footer too.
Cycle through all of the matching elements. <?variable@begin:name;'value'?> Examples
XSLT Equivalent Header region.
<xsl:for-each select=".//element">…</xsl:for-each> Define and set the XSLT variable name to the given value.
<?start:body?>Body region.<?end body?>
Examples Footer region.
<?for-each:ACAD_PROG?> … <?end for-each?> Formatting Template Tags
==============Section Break==============
<?for-each@inlines:CMNT?><?CMNT?> <?end for-each?> <?start@last-page:body?>Notes.<?end body?>
<?attribute@inline:name;'value'?>
<?sort@incontext:element;'order';'type'?> Set the XSL-FO formatting attribute name, to the give value. <?split-by-page-break:?>
Paired with <?for-each?>, sort the data by element, with the Insert a page break. Typically used in a repeating group.
<?format-number:element;'format'?>
contents treated as type (text or number), ordered by order Examples
Display the value of element, which must be a valid number,
(ascending or descending). … <?split-by-page-break:?><end for-each?>
XSLT Equivalent
formatted using the following formatting rules:
<xsl:sort select=".//element" order="order" 0 or 9 A digit, where 0's are padded, 9's are not. <?initial-page-number:page|'auto'?>
data-type="type" /> C or L Currency symbol or Local currency symbol. Set the page number, or prevent restarting after a section break.
Examples G or D or S Thousands Grouping (,), or Decimal (.) separators, or Sign (+). Examples
<?for-each:ACAD_PROG?><?sort:SEQ_NBR?>… MI or PR or PT Negatives are trailing, brackets <> or parenthesis (). <?for-each-group:EMPLID;CAREER?>
Examples <?initial-page-number:1?> …
<?for-each-group@block:element;group?> … <?format-number:GPA;'0D000'?>
<?end for-each-group?> <?section:force-page-count;'type'?>
Cycle through all of the matching elements, but only repeat the <?format-date:element;'format';['timezone']?> Create pages as necessary to end the report of the correct
loop once when the group element value changes. Display the value of element, which must be a valid date or number of pages according to type which may be 'end-on-even-
XSLT Equivalent date/time, formatted using the following rules: (common only) layout', 'end-on-odd-layout', 'end-on-even' or 'end-on-odd'.
<xsl:for-each-group select=".//element" YYYY or YY or CC Year as 4-digit or 2-digit or century 2-digit.
group-by="group"> … </xsl:for-each> MM Month as 2-digit. <?copy-to-bookmark:?>
Examples MON or MONTH Month name abbreviated or full padded to 9 chars. {Microsoft Word table of contents}
<?for-each-group:ACAD_PLAN;ACAD_PROG?> D or DD or DDD Day of week (7), day of month (31) or day of year (366). <?end copy-to-bookmark?>
<?ACAD_PROG?>… DY or DAY Day name abbreviated or full padded to 9 chars. Create PDF bookmarks from a previously generated Word table
<?for-each@block:current-group()?> … HH or HH12 or HH24 Hour am/pm (two forms) or 24-hour. of contents. Both the table of contents and bookmarks remain.
MI or SS of FF(1..9) Minutes or seconds or fractional second (digits).
Paired with <?for-each-group?>, cycle through just the elements <?convert-to-bookmark:?>
AM or A.M. or PM or P.M. AM/PM indicator with or without periods.
that share the current group value. LONG or MEDIUM or SHORT Abstract date only formats. {Microsoft Word table of contents}
XSLT Equivalent <?end convert-to-bookmark?>
LONG_TIME or MEDIUM_TIME or SHORT_TIME Abstract date/time.
<xsl:for-each select="current-group()"> …
Examples
Examples Create PDF bookmarks from a previously generated Word table
<?for-each@inlines:current-group()?><?ACAD_PLAN?>… <?format-date:DTTM;'DD/MM/YYYY HH:MI PM'?> of contents. Only the bookmarks remain, the table is discarded.
Keith’s Cheat Sheets BI Publisher Templates v1.0 (Jun ‘14)
Keith’s Cheat Sheets BI Publisher Templates v1.0 (Jun ‘14)

Dynamic Table Column Template Tags Templates & Sub-Templates <?xdoxslt:left('str',length)?> use also right()
Return just the first length characters of string str.
<?split-column-header@column:element?> <?template@end:name?>
Used in a column heading to define a dynamic (cross-tab) column Define a named template. The content will only be included <?xdofx:length('str')?> use also upper()
which is duplicated for each value of element. Pair with below. when called directly or matched by applying templates. Return the length of the string str in characters.
XSLT Equivalent
<?split-column-date@cell:element?> <?xdofx:lower('str')?> use also upper()
<xsl:template name="name"/>
Used in a column cell to define a dynamic (cross-tab) column Convert all uppercase characters in str to lowercase.
<?call@inblock:name?>
which is duplicated for each value of element. Pair with above. <?xdofx:lpad('str',length,'char')?> use also rpad()
Call a template which will include all of its content.
<?split-column-width:width?> XSLT Equivalent Pad left the string str, to length chars, using character char.
Optionally used with above, to define the column width. Unless a <xsl:call-template name="name"/>
<?xdoxslt:minimum(elements)?> use also maximum()
unit is specified, the width is considered a part of the total width. <?apply@inline:elements?> Return the minimum value of all elements in the set.
Call any templates which match any of the elements selected. Examples
<?split-column-width-unit:multiplier?>
This will only match XSLT defined templates, not BIP templates. <?xdofx:minimum(../BEGIN_DT)?>
Optionally used with above, to define a multiplier which causes
XSLT Equivalent <?xdoxslt:next_element(current-group(),.,
the width to be converted to an absolute value in points (1/72"). <xsl:apply-templates select="elements"/>
'element')?> use also prev_element()
<?horizontal-break-table:columns?> <?import@begin:url?> Return the relative next element in the current group.
Optionally used with above, to set a fix number of key columns to Import an XSLT or RTF file which should contain only template
repeat when dynamic columns repeat onto more than one page. <?xdofx:replace('str','from',['to'])?>
definitions. During testing this will be like "file:///U:/filepath.rtf",
Replace any and all occurrences of from, with to, in the string str.
Context Qualifiers on the server this will be like "psxmlp://CONTENT_ID".
Used as <?tag@context:?> or <xsl:tag xdofo:ctx="context"> <?xdoxslt:replicate('str',repeat)?>
Extended Functions Replicate the string str by repeat times, concatenated.
@section Prefixed xdofx: which mimic SQL equivalents, and xdoxslt: which extend XSLT.
Tag affects or creates an entire section, including the header and <?xdofx:round(number,[places])?> also xdoxslt:round()
<?xdoxslt:abs(number)?>
footer. Typically used with <?for-each@section:…?>. Round number to the given number of places or zero.
Return the absolute value of number.
@column <?xdoxslt:sec_diff('datetime1','datetime2',
<?xdofx:chr(ascii)?> $_XDOLOCALE,$_XDOTIMEZONE)?>
Tag affects an entire table column. Typically used with Return the character for the ascii value.
<?if@column:…?> to hide/show an entire column. Calculate the difference in seconds between datetime1 and
<?xdofx:ceil(number)?> use also floor() datetime2, where both date/times must be in the format
@cell Return the smallest integer greater than or equal to number. 'yyyy-mm-ddThh:mm:ss'.
Tag affects just the cell of a table. Typically used in combination
with @column to create dynamic columns. <?xdofx:decode('str','case','res'…,['othr']) <?xdoxslt:set_array($_XDOCTX,'array',index,
Search for a match between str and any case string, then return 'value')?> use also get_array()
@block the result res. If no match is found, the result othr is returned. Store in the named array, at the index, the given value.
Tag affects an entire block of text, such as a Word paragraph or a Examples
table cell. This is the default context for many tags. fo:block <?xdofx:decode(FLAG,'A','Active','I','Inactive')?>
<?xdofx:substr('str',start,length)?>
Extract the substring of str, from start, for length characters.
@inblock <?xdoxslt:date_diff('units','date1','date2',
Tag is a single statement within a block. $_XDOLOCALE,$_XDOTIMEZONE)?> <?xdofx:sysdate()?>
Calculate the difference between date1 and date2, where both Returns the current system date/time.
@inlines
dates must be in the format 'yyyy-mm-dd', and where the result <?xdoxslt:trim('str')?> use also ltrim() & rtrim()
Tag affects consecutive smaller inline statements forming a string
is in units: y, m, w, d, h, mi, s, ms Trim both leading and trailing spaces from string str.
of text. Typically used with <?if@inlines:…?>.
<?xdoxslt:get_day('date',$_XDOLOCALE)?> <?xdoxslt:truncate(number,[places])?>
@inline
Extract just the day part of a date which must be in the format Truncate the number to the given decimal places, where places
Tag is a single statement. fo:inline
'yyyy-mm-dd'. Similarly use get_month() and get_year(). can be negative, and places defaults to zero.
@incontext
<?xdofx:greatest(item1,[item2,…])?> use also least()
Tag is inserted immediately after the surrounding tags, such as Embedded Image XSL-FO Elements
Return the greatest of all items, all are treated as type of item1.
with <?sort:…?>. <fo:instream-foreign-object content-type="image/?"
<?xdofx:instr('str','srch',[start],[nth]) height="h px|in|cm|%" width="w px|in|cm|%">
@begin or @end
Return the position of the nth occurrence of srch within str, <xsl:value-of select="BASE64" />
Tag is placed at the beginning/end of the XSLT stylesheet. Begin
starting at start, which can be negative to reverse the search. </fo:instream-foreign-object>
context is applied to <xsl:variable> tags unless overridden. Image types supported are "image/gif", "image/jpg" and "image/png"

Keith’s Cheat Sheets BI Publisher Templates v1.0 (Jun ‘14)

You might also like