Renderers
A full example
Lavoisier does all it can to provide a view matching to the requested extension, but you have to know that you can refine this behaviour using a dedicated xml tag <pre-renderers>, appended as the last child of the tag <view>. First let's go a little further by exploring the render categories.
They are 3 categories of renderers :
<renderers> <renderer type="DefaultRenderer"> <parameter name="contentType">image/svg+xml</parameter> </renderer> </renderers>
<report> <earnings year="2010"> <sales month="01">304</sales> <sales month="02">310</sales> <sales month="03">370</sales> <sales month="04">375</sales> </earnings> <earnings year="2011"> <sales month="01">321</sales> <sales month="02">400</sales> <sales month="03">414</sales> <sales month="04">401</sales> </earnings> <earnings year="2012"> <sales month="02">302</sales> <sales month="02">310</sales> <sales month="03">313</sales> <sales month="04">350</sales> </earnings> </report>
Position,earningsYear 1,2010 2,2011 3,2012
<pre-renderers> <title>"Earnings report"</title> <row foreach="report/earnings/sales"> <column label="date">concat(../@year,'-', @month)</column> <column label="nb_products" unit="nb">text()</column> </row> </pre-renderers>
date,nb_product 2010-01,304 2010-02,310 2010-03,370 2010-04,375 2011-01,321 2011-02,400 2011-03,414 2011-04,401 2012-02,302 2012-02,310 2012-03,313 2012-04,350
<renderers html="report.xsl"> <renderer type="ChartRenderer"> <parameter name="types"> <entry eval="$chart"></entry> </parameter> </renderer> </renderers>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"></xsl:output> <xsl:param name="table"></xsl:param> <xsl:template match="/"> <html> <head> <title>Earnings reports</title> <!-- include css using internal Lavoisier bootstrap style via a view--> <link href="/resource/rsc/stylesheet.css?accept=css" rel="stylesheet" type="text/css"></link> </head> <body> <h1>Number of products by year/month</h1> <xsl:apply-templates select="/report/earnings"></xsl:apply-templates> </body> </html> </xsl:template> <xsl:template match="earnings"> <table> <xsl:attribute name="class">table <xsl:value-of select="$table"></xsl:value-of></xsl:attribute> <tr> <td> <xsl:attribute name="rowspan"> <xsl:value-of select="count(sales)+1"></xsl:value-of> </xsl:attribute> <h2> Year <br></br> <xsl:value-of select="@year"></xsl:value-of> </h2> </td> </tr> <xsl:apply-templates select="sales"></xsl:apply-templates> </table> <br></br> </xsl:template> <xsl:template match="sales"> <tr> <td> <xsl:value-of select="@month"></xsl:value-of> </td> <td> <xsl:value-of select="."></xsl:value-of> </td> </tr> </xsl:template> </xsl:stylesheet>
<renderers html="xsl/report.xsl"> <parameter name="table" eval="$table"></parameter> </renderers>