1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:fo="http://www.w3.org/1999/XSL/Format">
6 <xsl:template match="/">
7 <xsl:call-template name="rml" />
11 <xsl:template name="rml">
12 <document filename="example.pdf">
13 <template pageSize="29.7cm,21cm" leftMargin="2.0cm" rightMargin="2.0cm" topMargin="2.0cm" bottomMargin="2.0cm" title="Timesheets" author="Generated by Tiny ERP, Fabien Pinckaers" allowSplitting="20">
14 <pageTemplate id="first">
15 <frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
20 <paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="center" />
21 <paraStyle name="normal-title" fontName="Helvetica" fontSize="6" />
22 <paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
23 <paraStyle name="employee" fontName="Helvetica-Oblique" fontSize="10" textColor="blue" />
24 <paraStyle name="glande" textColor="red" />
25 <paraStyle name="normal_people" textColor="green" />
26 <paraStyle name="esclave" textColor="purple" />
27 <blockTableStyle id="month">
28 <blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
29 <blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/>
30 <blockFont name="Helvetica" size="6" start="0,2" stop="-2,-2"/>
31 <blockFont name="Helvetica-BoldOblique" size="8" start="0,-1" stop="-1,-1"/>
32 <blockBackground colorName="#AAAAAA" start="1,0" stop="-2,1"/>
33 <xsl:for-each select="/report/days/day[@name='Sat' or @name='Sun']">
34 <xsl:variable name="col" select="attribute::number" />
36 <xsl:attribute name="colorName">lightgrey</xsl:attribute>
37 <xsl:attribute name="start">
38 <xsl:value-of select="$col" />
39 <xsl:text>,0</xsl:text>
41 <xsl:attribute name="stop">
42 <xsl:value-of select="$col" />
43 <xsl:text>,-1</xsl:text>
47 <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
48 <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
49 <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
50 <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
51 <blockValign value="TOP"/>
56 <xsl:call-template name="story"/>
61 <xsl:template name="story">
62 <para style="title" t="1">Timesheet</para>
63 <spacer length="1cm" />
64 <para style="employee"><xsl:value-of select="/report/employee" /></para>
65 <spacer length="1cm" />
67 <xsl:attribute name="style">month</xsl:attribute>
68 <xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute>
70 <td><xsl:value-of select="report/date/attribute::year" /></td>
71 <xsl:for-each select="report/days/day">
73 <xsl:value-of select="attribute::name" />
79 <td><xsl:value-of select="report/date/attribute::month" /></td>
80 <xsl:for-each select="report/days/day">
82 <xsl:value-of select="attribute::number" />
87 <xsl:apply-templates select="report/account"/>
90 <xsl:for-each select="report/days/day">
91 <xsl:variable name="today" select="attribute::number" />
95 <xsl:when test="sum(//time-element[@date=$today]) < 7.5">
96 <xsl:attribute name="style">glande</xsl:attribute>
98 <xsl:when test="sum(//time-element[@date=$today]) < 8.5 and sum(//time-element[@date=$today]) >= 7.5">
99 <xsl:attribute name="style">normal_people</xsl:attribute>
102 <xsl:attribute name="style">esclave</xsl:attribute>
105 <xsl:value-of select="sum(//time-element[@date=$today])" />
110 <xsl:value-of select="sum(//time-element)" />
116 <xsl:template match="account">
117 <xsl:variable name="aid" select="attribute::id" />
120 <para style="normal-title"><xsl:value-of select="attribute::name" /></para>
122 <xsl:for-each select="/report/days/day">
123 <xsl:variable name="today" select="attribute::number" />
125 <para style="normal"><xsl:value-of select="//account[@id=$aid]/time-element[@date=$today]" /></para>
129 <para style="normal"><xsl:value-of select="sum(//account[@id=$aid]/time-element)" /></para>