How to regroup the XML Data
The XLS template supports the XSL 2.0 for-each-group standard that allows you to regroup XML data into hierarchies that are not present in the original data. With this feature, your template does not have to follow the hierarchy of the source XML file. You are therefore no longer limited by the structure of your data source.

Regrouping Syntax

To regroup the data, use the following syntax:

<?for-each-group:BASE_GROUP;GROUPING_ELEMENT?>

For example, to regroup the G_FULL_NAME listing by YEAR_OF_BIRTH, enter the following in your template:

<?for-each-group:G_FULL_NAME;YEAR_OF_BIRTH?>

The elements that were at the same hierarchy level as YEAR_OF_BIRTH are now children of YEAR_OF_BIRTH. You can then refer to the elements of the group to display the values desired.

To establish nested groupings within the already defined group, use the following syntax:

<?for-each:current-group()?>

or

<?for-each-group:current-group();GROUPING_ELEMENT?>

For example, after declaring the G_FULL_NAME grouping by YEAR_OF_BIRTH, you can then further group by EMPLOYEE_NUMBER within YEAR_OF_BIRTH as follows:

<?for-each-group:current-group();EMPLOYEE_NUMBER?>

At runtime, XML Publisher will loop through the occurrences of the new groupings, displaying the fields that you defined in your template.

Regrouping by an Expression

Regrouping by an expression allows you to apply a function or command to a data element, and then group the data by the returned result.
To use this feature, state the expression within the regrouping syntax as follows:

<?for-each:BASE_GROUP;GROUPING_EXPRESSION?>

This example is displayed in the figure below (download the example):

Grau op Tuesday 05 May 2009 - 09:34:12

  printer friendly   create pdf of this news item