cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcelo F. Ochoa" <moc...@ieee.org>
Subject RE: XML to EXCEL???? (output)
Date Thu, 06 Jul 2000 11:48:53 GMT

Hi, guys
I have a very simple question:
Is there any parser or processor that can transform an XML page to an
Excel file and/or viceversa.
[>]  To generates an excel output there is a simple trick.
Add to cocoon.properties this lines:
formatter.type.application/vnd.ms-excel = org.apache.cocoon.formatter.TextFormatter
[>]  # Excel Formatter
formatter.application/vnd.ms-excel.MIME-type = application/vnd.ms-excel
[>]  Then, if you have a XML like this:
<?xml version="1.0"?>
<?xml-stylesheet href="http://server:port/xsl/excel.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<sales>
<name id="Bunny Boot">
<city>Seattle</city>
<point>625</point>
<stock>-25</stock>
</name>
<name id="Ace Ski Boot">
<city>Seattle</city>
<point>560</point>
<stock>-40</stock>
</name>
....
</sales>
<!-- Author: Marcelo F. Ochoa "mochoa@exa.unicen.edu.ar" -->

where excel.xsl is a simple stylesheet which add <tab> between cols and <cr> after
each row, ej:
<?xml version="1.0"?>

<!-- Written by Marcelo F. Ochoa "mochoa@exa.unicen.edu.ar" -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
   <xsl:processing-instruction name="cocoon-format">type="application/vnd.ms-excel"</xsl:processing-instruction>
   <html>
           <xsl:for-each select="sales/name">
                <xsl:sort select="point"
                          data-type="number"
                          order="ascending"/>
                <xsl:value-of select="@id"/><xsl:text>	</xsl:text>
                <xsl:value-of select="city"/><xsl:text>	</xsl:text>
                <xsl:value-of select="point"/><xsl:text>	</xsl:text>
                <xsl:value-of select="stock"/><xsl:text>	</xsl:text>
                <xsl:text>
</xsl:text>
           </xsl:for-each>
   </html>
  </xsl:template>

</xsl:stylesheet>

And that's all....  
I have to design a new system and I'll really like to use Cocoon but
also I want to add a new feature like this.
I looked for it in the Microsoft's page, but they just have this very
expensive BizTalk Server or something  like that can do this kind of
work, but I would like to find an open source tool !!!

Thanks for your help

--
Computers let you make More mistakes faster
than any other invention in human history
with the possible exception of handguns and tequila.


cArLos  8-)

[>]  Reagards, Marcelo. 
[>]  
PD: Excel to XML is another history.
Mime
View raw message