<?xml version="1.0"?>
<!--
	Create the page layout 
-->

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
	xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
	xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
	xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
	xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
	xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0">

	<xsl:template match="office:document-content">
		<importacao>
			<xsl:apply-templates select="office:body" />
		</importacao>
	</xsl:template>

	<xsl:template match="office:body">
		<xsl:apply-templates select="office:spreadsheet" />
	</xsl:template>

	<xsl:template match="office:spreadsheet">
		<xsl:apply-templates select="table:table" />
	</xsl:template>

	<xsl:template match="table:table">
		<xsl:for-each select="table:table-row">
			<entrada>
				<xsl:if test="position() &gt; 1">
					<xsl:for-each select="table:table-cell">
						<xsl:choose>
							<xsl:when test="position() = 1">
								<tema>
									<xsl:apply-templates />
								</tema>
							</xsl:when>
							<xsl:when test="position() = 2">
								<risco>
									<xsl:apply-templates />
								</risco>
							</xsl:when>
							<xsl:when test="position() = 3">
								<requisito>
									<xsl:apply-templates />
								</requisito>
							</xsl:when>
							<xsl:when test="position() = 4">
								<medida>
									<xsl:apply-templates />
								</medida>
							</xsl:when>
						</xsl:choose>
					</xsl:for-each>
				</xsl:if>
			</entrada>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="text:p">
		<linha>
			<xsl:value-of select="." />
		</linha>
	</xsl:template>
</xsl:stylesheet>
