Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Filename:Room list.xfd
LevelMedium
XML from report:Room -> Room list -> With area sums
XML sample file:xml/rooms.xml
Key conceptsRepeating table, key/index

This is a simple list of all rooms. It has a repeating table (see 3.6) for room that was created by just dragging the <room> XML node from the data source pane (3) from drofus-xml/room-container into the document.

The “hard” part of this report is the third column that shows the top function name (department) in which this room is placed. The header field for this column uses the top <level> attribute description which contains the description of this function level. This uses the following expression

/drofus-xml/level[1]/@description

This simply goes to the first level node in the document and gets the @description attribute.

To get the column content we have to look in the <level> hierarchy which represents the functional structure. In this we will find all the same rooms as in the <room-container> but only the rooms that has a @ref attribute that refers to the room-container/room/@id attribute. To be able to reference this room we need an index. To create this, paste the following code in to the Review->Global XSLT window.

<xsl:key match="room" name="room-ref-key" use="@ref"/>

This will index all <room> nodes based on the ref attribute. We can then use this to look up the same room as we are currently processing by doing

key('room-ref-key', @id)

Because we also want the top level above this room the complete expression for the field is:

key('room-ref-key',@id)/ancestor::level[last()]/@name

This looks up the room in the level tree, gets all the level nodes above it, picks the last one and the gets the name attribute, phui...

 

  • No labels