git-svn-id: https://svn.coded.pt/svn/SIPRP@935 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 17 years ago
parent c3fa4b9e06
commit a3a3da945c

@ -0,0 +1,35 @@
package siprp.higiene.gestao.importacao;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.evolute.utils.xml.XSLTransformer;
public class Importador
{
public static void main( String args[] )
throws Exception
{
Importador importador = new Importador();
importador.converter();
}
public void converter()
throws Exception
{
InputStream xsl = getClass().getClassLoader().getResourceAsStream( "siprp/higiene/gestao/importacao/importacao_ods_to_xml.xsl" );
InputStream xmlContent = getClass().getClassLoader().getResourceAsStream( "siprp/higiene/gestao/importacao/content.xml" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XSLTransformer.getXSLTransformer().transform( xmlContent, xsl, baos );
FileOutputStream fos = new FileOutputStream( "/home/fpalma/projectos2/SIPRP/SIPRPSoft/src/siprp/higiene/gestao/importacao/data.xml" );
fos.write( baos.toByteArray() );
fos.close();
System.out.println( new String( baos.toByteArray() ) );
}
public void importar()
{
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,67 @@
<?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>
Loading…
Cancel
Save