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="purple" />
25
<paraStyle name="normal_people" textColor="green" />
26
<paraStyle name="esclave" textColor="red" />
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']">
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+1" />
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" />
65
<xsl:attribute name="style">month</xsl:attribute>
66
<xsl:attribute name="colWidths"><xsl:value-of select="report/cols" /></xsl:attribute>
68
<td><xsl:value-of select="report/date/attribute::year" /></td>
69
<xsl:for-each select="report/days/day">
71
<xsl:value-of select="attribute::name" />
77
<td><xsl:value-of select="report/date/attribute::month" /></td>
78
<xsl:for-each select="report/days/day">
80
<xsl:value-of select="attribute::number" />
85
<xsl:apply-templates select="report/employee"/>
86
<xsl:for-each select="report/employee">
87
<xsl:variable name="id" select="attribute::id"/>
89
<td t="1"><xsl:value-of select="attribute::name"/></td>
90
<xsl:for-each select="//report/days/day">
91
<xsl:variable name="today" select="attribute::number" />
95
<xsl:when test="sum(//employee[@id=$id]/time-element[@date=$today]) < 7.5">
96
<xsl:attribute name="style">glande</xsl:attribute>
98
<xsl:when test="sum(//employee[@id=$id]/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="//employee[@id=$id]/time-element[@date=$today]" />
110
<xsl:value-of select="sum(//employee[@id=$id]/time-element)"/>
116
<xsl:for-each select="report/days/day">
117
<xsl:variable name="today" select="attribute::number"/>
118
<td t="1"><xsl:value-of select="sum(//time-element[@date=$today])"/></td>
120
<td t="1"><xsl:value-of select="sum(//time-element)"/></td>