Document toolboxDocument toolbox

Item List Grouped

Filename:

Item list group.xfd

Level

Advanced

XML from report:

Item -> FF&E list -> FF&E list grouped by FF&E level

XML sample file:

xml/file_with_cost.xml

Key concepts

Dynamic indentation, condition, table repeat, key/index

This report demonstrates how to print the hierarchical FF&E catalog structure with FF&E items. The report traverses the <level> structure that represents the FF&E catalog structure. To do this we have a repeating section over the <level> nodes. It is important to note that <level> nodes are nested in each other to represent the hierarchical structure. For this reason, simply drag and drop the first level on to the document and create a repeating section over the expression that is created (/drofus-xml/level). The expression will not work because it will only iterate over the <level> nodes at the top level, not the sub levels. To get this done we use an expression that will select all <level> nodes in the document regardless of where it is placed in the XML structure. This expression can be:

//level

//level

To get an indent for subgroups we use a dynamic value for the ‘Alignment & Indentation -> Start Indent’ property set to: concat(@depth*5,’mm’). This uses the depth attribute for the level which is 0 for the group (top level), 1 for subgroups etc. this is multiplied with 5 and the result is concatenated with mm that gives the length unit in millimeter. You can use inc to get inches. This gives an indentation of 0 for groups, 5 for subgroups, 10 for sub sub group and so on.

Below each group is a table with FF&E items (articles). The table is inside a conditional section where the condition is count(article) > 0 that will return false if there is no items in the group. This will prevent the table header to appear when there is no need for it. You can insert a conditional section from Insert->Conditional Section.

The table has a table header and a repeatable row as explained in 3.6. Use the XPATH expression article.

In the xml source the level node has child nodes called <article> that represents an FF&E item. This node has only one attribute, @ref, that contains an id to an article item under the /drofus-xml/article-container node. To get to the FF&E item data we need to do a look up under the correct <article> node that has this same id. To do this efficiently we create a index that we can use. See 5.3 to learn more about indexes. To do this, paste the following code into the Review->Global XSLT window.

<xsl:key match="article" name="article-index" use="@id"/>

<xsl:key match="article" name="article-index" use="@id"/>

This will index all <article> nodes based on the id attribute.

To create a table column, e.g. the FF&E no column, choose Insert->Field and enter the following XPATH expression

key('article-index', @ref)/core/@article_func_no

key('article-index', @ref)/core/@article_func_no

You could then of course copy/paste this field into the other column. Look under article-container/article for available fields.

The sum for each group is printed after each FF&E listing and the sum for groups with sub groups is also listed after each of the subgroups. To get this done we have two conditional sections. The first one will print the sum after each listing and should be done only if there are no sub groups so the condition for this is:

not(level)

not(level)

To get the sum for all the groups that have subgroups, we need to do this at the end of the last subgroup. To do this we use the following condition:

not(following-sibling::level) and parent::level

not(following-sibling::level) and parent::level

This one ensures that it is the last level and that it has a parent level.