cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcelo F. Ochoa" <>
Subject Re: Cocoon2:XSP->Excel?
Date Tue, 13 Nov 2001 00:18:15 GMT
Skladov, Victor wrote:

>Hi, people!
>Does anydody have expirience in creating EXCEL-Tables with XSP?
>What must I do to get a true EXCEL Table from a XSP and XSL?
>Thanks in advance
  To returns Excel files from Cocoon 2 there is a simple trick:
  If you returns from your XSP an XML like this:

<?xml version='1.0' encoding='iso-8859-1'?>
<ROW empno="1">
<ROW empno="2">
<job>VP, Operations</job>
<ROW empno="3">
<job>VP, Sales</job>

 And transform it with an stylesheet like this:
<?xml version="1.0"?>
<!-- Written by Marcelo F. Ochoa "" -->
<xsl:stylesheet xmlns:xsl="">
  <xsl:template match="/">
       <tr><th>Emp Number</th><th>Name</th><th>Job</th><th>Sal</th></tr>
           <xsl:for-each select="ROWSET/ROW">
              <xsl:sort select="sal"
                <td><xsl:value-of select="@empno"/></td>
                <td><xsl:value-of select="name"/></td>
                <td><xsl:value-of select="job"/></td>
                <td><xsl:value-of select="sal"/></td>

  and finally adding this definitions into sitemap.xmap

   <map:serializer name="excel"  mime-type="application/"  

   <map:match pattern="xmlj/DEMOj.excel">
    <map:generate type="serverpages" src="/xmlj/DEMOj.xsp"/>
    <map:transform src="stylesheets/dbprism/excel.xsl"/>
    <map:serialize type="excel"/>

  and that's all.
  You could see this demo on-line at:
  Best regards, Marcelo.

Marcelo F. Ochoa -
Do you Know DB Prism? Look @
More info?
Chapter 21 of the book "Professional XML Databases" (Wrox Press
Chapter 8 of the book "Oracle & Open Source" (O'Reilly
Lab. de Sistemas - Fac. de Cs. Exactas - UNICEN
Paraje Arroyo Seco - Campus Universitario
(7000) Tandil - Bs. AS. - Argentina
Te: +54-2293-444430 Fax: +54-2293-444431

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message