<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
	<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
	<xsl:template match="lista-presencas">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm" margin-right="1cm">
					<fo:region-body margin-top="16pt" margin-bottom="12pt"/>
				</fo:simple-page-master>
			</fo:layout-master-set>
			<fo:page-sequence master-reference="simpleA4">
				<fo:flow flow-name="xsl-region-body">
					<xsl:for-each select="presenca">
						<xsl:choose>
							<xsl:when test="position() mod 2 = 0" >
								<fo:block break-after="page" >
									<xsl:apply-templates select="." />
								</fo:block>
							</xsl:when>
							<xsl:otherwise >
								<fo:block space-after="40pt">
									<xsl:apply-templates select="." />
								</fo:block>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:for-each>
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
	
	<xsl:template match="presenca">
		<fo:table table-layout="fixed" width="100%">
			<fo:table-column  />
			<fo:table-body>
				<fo:table-row height="350pt" >
					<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
						<fo:block font-size="14pt" font-weight="bold" space-after="4pt" space-before="8pt" padding-left="8pt">
							Realiza&#xe7;&#xe3;o de ECDs
						</fo:block>
						<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">
							<xsl:value-of select="trabalhador" />
						</fo:block>
						<fo:block font-size="10pt" space-after="4pt" padding-left="8pt">
							( <xsl:value-of select="empresa" /> )
						</fo:block>
						<fo:block font-size="12pt" font-weight="bold" space-after="4pt" padding-left="8pt">
							data: <xsl:value-of select="data" />
						</fo:block>
						<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">
							hora de entrada: __h__m
						</fo:block>
						<fo:block padding-left="8pt" padding-right="8pt" space-after="8pt">
							<fo:table>
								<fo:table-column column-width="200pt"/>
								<fo:table-column column-width="100pt"/>
								<fo:table-column />
								<fo:table-body>
									<fo:table-row>
										<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
											<fo:block font-size="12pt" font-weight="bold" text-align="center" >
												ECD
											</fo:block>
										</fo:table-cell>
										<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
											<fo:block font-size="12pt" font-weight="bold" text-align="center" >
												R&#xfa;brica
											</fo:block>
										</fo:table-cell>
										<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
											<fo:block font-size="12pt" font-weight="bold" text-align="center" >
												Motivo de n&#xe3;o realiza&#xe7;&#xe3;o
											</fo:block>
										</fo:table-cell>
									</fo:table-row>
									<xsl:for-each select="ecd">
										<fo:table-row>
											<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
												<fo:block font-size="10pt" >
													<xsl:value-of select="." />
												</fo:block>
											</fo:table-cell>
											<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
												<fo:block font-weight="bold" text-align="center" >
													
												</fo:block>
											</fo:table-cell>
											<fo:table-cell border-color="black" border-style="solid" border-width="thin" >
												<fo:block font-weight="bold" text-align="center" >
													
												</fo:block>
											</fo:table-cell>
										</fo:table-row>
									</xsl:for-each>
								</fo:table-body>
							</fo:table>
						</fo:block>
						<fo:block font-size="12pt" font-weight="bold" space-after="8pt" padding-left="8pt">
							hora de sa&#xed;da: __h__m
						</fo:block>
						<fo:block font-size="12pt" font-weight="bold" padding-left="8pt">
							assinatura do trabalhador:________________________________________
						</fo:block>
					</fo:table-cell>
				</fo:table-row>
			</fo:table-body>
		</fo:table>
	</xsl:template>
</xsl:stylesheet>

