Advanced Design Options

If you have more complex design requirements, XML Publisher supports the use of XSL and XSL:FO elements, and has also extended a set of SQL functions.

RTF templates offer extremely powerful layout options using XML Publisher's syntax. However, because the underlying technology is based on open W3C standards, such as XSL and XPATH, you are not limited by the functionality described in this guide. You can fully utilize the layout and data manipulation features available in these technologies.

Using XSL Elements

You can use any XSL element in your template by inserting the XSL syntax into a form field.

If you are using the basic RTF method, you cannot insert XSL syntax directly into your template. XML Publisher has extended the following XSL elements for use in RTF templates.

To use these in a basic-method RTF template, you must use the XML Publisher Tag form of the XSL element. If you are using form fields, use either option.

Apply a Template Rule

Use this element to apply a template rule to the current element's child nodes.

XSL Syntax: <xsl:apply-templates select="name">

XML Publisher Tag: <?apply:name?>

This function applies to <xsl:template-match="n"> where n is the element name.

Copy the Current Node

Use this element to create a copy of the current node.

XSL Syntax: <xsl:copy-of select="name">

XML Publisher Tag: <?copy-of:name?>

Call Template

Use this element to call a named template to be inserted into or applied to the current template. For example, use this feature to render a table multiple times.

XSL Syntax: <xsl:call-template name="name">

XML Publisher Tag: <?call-template:name?>

Template Declaration

Use this element to apply a set of rules when a specified node is matched.

XSL Syntax: <xsl:template name="name">

XML Publisher Tag: <?template:name?>

Variable Declaration

Use this element to declare a local or global variable.

XSL Syntax: <xsl:variable name="name">

XML Publisher Tag: <?variable:name?>

Example:

 <xsl:variable name="color" select="'red'"/> 

Assigns the value "red" to the "color" variable. The variable can then be referenced in the template.

Import Stylesheet

Use this element to import the contents of one style sheet into another.

Note: An imported style sheet has lower precedence than the importing style sheet.

XSL Syntax: <xsl:import href="url">

XML Publisher Tag: <?import:url?>

Define the Root Element of the Stylesheet

This and the <xsl:stylesheet> element are completely synonymous elements. Both are used to define the root element of the style sheet.

Note: An included style sheet has the same precedence as the including style sheet.

XSL Syntax: <xsl:stylesheet xmlns:x="url">

XML Publisher Tag: <?namespace:x=url?>

Note: The namespace must be declared in the template. See Namespace Support.

Native XSL Number Formatting

The native XSL format-number function takes the basic format:

format-number(number,format,[decimalformat])
Parameter Description
number Required. Specifies the number to be formatted.
format Required. Specifies the format pattern. Use the following characters to specify the pattern:
  • # (Denotes a digit. Example: ####)

  • 0 (Denotes leading and following zeros. Example: 0000.00)

  • . (The position of the decimal point Example: ###.##)

  • , (The group separator for thousands. Example: ###,###.##)

  • % (Displays the number as a percentage. Example: ##%)

  • ; (Pattern separator. The first pattern will be used for positive numbers and the second for negative numbers)

decimalformat Optional. For more information on the decimal format please consult any basic XSLT manual.

Using FO Elements

You can use the native FO syntax inside the Microsoft Word form fields.

For more information on XSL-FO see the W3C Website at http://www.w3.org/2002/08/XSLFOsummary.html

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