The pre-renderers section convert your data view to a 2D array representation, in order to adapt it to 2D-based rendering format (e.g. CSV, chart, HTML table...). Configuring this section is optional, but it allows for complete control on 2D-renderings. Moreover, it may improve performance if a lot of data is rendered, because the code generated from this section will always be simpler than the code of the default pre-rendering behavior (which is designed to support any XML format).
You will find below a complete example browsing most of the possibilities of this section. Copy-paste this view configuration in your etc/lavoisier-config.xml and check the result : /lavoisier/rowcol
Notice:You can also generate the rowcol format using an XSL file. You just have to set attribute @row-column of the pre-renderer tag with the location of your stylesheet. Please find an example here. |
<root date="January 2013"> <language slug="C_(programming_language)" rate="6.1%">C++</language> <language slug="C_(programming_language)" rate="17.8%">C</language> <language slug="Objective-C" rate="9.1%">Objective-C</language> <language slug="C_Sharp_(programming_language)" rate="5.5%">C#</language> <language slug="Java_(programming_language)" rate="17.4%">Java</language> </root>
<pre-renderers> <title>concat("Programming Language - TOP ", count(/root/language))</title> <field label="source" link="http://www.tiobe.com">concat("TIOBE ",/root/@date)</field> <row foreach="root/language"> <column label="Position">position()</column> <column label="Programming Language" link="http://en.wikipedia.org/wiki/{@slug}">text()</column> <column label="Ratings" order="descending" unit="%">substring-before(@rate, "%")</column> </row> </pre-renderers>
<title>concat("Programming Language - TOP ", count(/root/language))</title>
<field label="source" link="http://www.tiobe.com">concat("TIOBE ",/root/@date)</field>
<row foreach="root/language"></row>
<column label="Position">position()</column>
<column label="Programming Language" link="http://en.wikipedia.org/wiki/{@slug}">text()</column>
<column label="Ratings" order="descending" unit="%">substring-before(@rate, "%")</column>