Current position:  Home > Default > Dynamic Columns, using the element name as the column header name

Dynamic Columns, using the element name as the column header name

Time:October 11
Advertisement
BI Publisher Experts,
I'm a relative newbie in the RTF layout world and i'm trying to acheive a layout which dynamically nominates the column headers as the element name.
For example using the XML below:
<?xml version="1.0" encoding="UTF-8" ?>
- <ROWSET>
- <DATA>
- <THREECOLUMNDATA>
<FIRST_NAME>First Name</FIRST_NAME>
<LAST_NAME>Last Name</LAST_NAME>
<EMAIL>[email protected]</EMAIL>
</THREECOLUMNDATA>
</DATA>
</ROWSET>
Excuse formatting, looked ok in preview!
I'd like to acheive the following output:
| FIRST_NAME | LAST_NAME | EMAIL |
|-----------------------|---------------------- |--------------------------------------------------------|
| First Name | Last Name | [email protected] |
I've managed to get the row data columns working using:
<[email protected]:current()/*?><?.?><?parent::*/text()?> <?end for-each?>
And i've been working on the header for a while now, using
<[email protected]:current()/THREECOLUMNDATA[1]/*?><?name(.)?><?end for-each?>
But no luck with the header. I only ever get a blank header.
I've also reviewed the following syntax:
<?split-column-header:THREECOLUMNDATA?> <?/FIRST_NAME?>
But of course, this pulls specific element data out as the header, not quite what I need.
Question is: Is there specific functionality to pull the element name out as the header, or do I somehow specifically need to include the header name as a data value in the XML?
Advice appreciated!
Advertisement
If you could get your XML to look like this instead of what you have, you will be able to use split-column-header and split-column-data
<?xml version="1.0" encoding="UTF-8" ?>
<ROWSET>
<DATA>
<THREECOLUMNDATA>
<COL_DTLS>
<COL_LABEL>FIRST_NAME</COL_LABEL>
<COL_VALUE>First Name</COL_VALUE>
</COL_DTLS>
<COL_DTLS>
<COL_LABEL>LAST_NAME</COL_LABEL>
<COL_VALUE>Last Name</COL_VALUE>
</COL_DTLS>
<COL_DTLS>
<COL_LABEL>EMAIL</COL_LABEL>
<COL_VALUE>[email protected]</COL_VALUE>
</COL_DTLS>
</THREECOLUMNDATA>
</DATA>
</ROWSET>
Now if you <?split-column-header:COL_DTLS?><?COL_LABEL?> and <?split-column-data:COL_DTLS?><?COL_VALUE?> you'll get the required output...