cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Ochoa <moc...@ieee.org>
Subject Re: Transforming XML ito open in Excel
Date Thu, 01 Mar 2001 18:30:44 GMT
Hi Carl:
  You are right.
  Here an example the lines added to the cocoon.properties configurations
file:

formatter.type.application/vnd.ms-excel =
org.apache.cocoon.formatter.TextFormatter
formatter.application/vnd.ms-excel.MIME-type = application/vnd.ms-excel

  And here an stylesheet which produce the correct output:

<?xml version="1.0"?>

<!-- Written by Marcelo F. Ochoa "mochoa@ieee.org" -->

<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-ins
truction>
   <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>

   This stylesheet makes a tab separated field, one row per line, which
is automatically converted by Excel in an spreadsheet.
   Best regards, Marcelo.

PD: Here the demo on line:
http://cocodrilo.exa.unicen.edu.ar:7777/servlets/xml/demo.xmlexcel?produ
cer=db

--
Do you know DB Prism look @ http://www.plenix.com/dbprism/
More info?
- Chapter 21 “Profesional XML Databases” at Wrox Press
(http://www.wrox.com/)
- Chapter 8 “Oracle & Open Source” by O'Reilly (http://www.oreilly.com/)
Marcelo F. Ochoa
Fac. de Cs. Exactas - UNICEN
Paraje Arroyo Seco - Campus Univ.
(7000) Tandil - AR
Tel.: +54-2293-444430
Fax: +54-2293-444431

Mime
View raw message