If you are new to Cocoon, I would put the email requirement, and
produce a (virtual) spreadsheet in the user's browser.

You scheme of work can then follow the most usual Cocoon sitemap design:
i) A generator (Non-XML to XML)
ii) One or more Transformation steps (XML_1 to XML_2 to XML_3 to ..., as required)
iii) A serialiser (XML to Non-XML)

i. I generally use an ESQL logicsheet for reading my database, which is a generator and has to go at the start of your pipeline. But I find it simpler than an 'Action' which can go anywhere in the pipeline. It turns your payload of data into an XML format which you can design yourself; as well as coding various errors and empty payloads
in XML. (cf Appendix E of Mozcar and Aston )

ii. You then need to write XSLT to turn this XML into something acceptable to the HSSF serialiser. I'm not sure how up to date it is, or how up to date the HSSF
serialiser, but you can get some documentation from:

www.jfree.org/jworkbook/download/gnumeric-xml.pdf

Data values are pretty much OK to deal with, but formulas are hell (IMHO). No
wonder its called HSSF (Horrible Spread Sheet Format).

iii. The HSSF serialiser can be used out of the box. Look at the Cocoon
Samples 'Hello World' (Excel pipeline) to see how to set the correct
Mime-type.

In fact, the best approach for most people, is to start with a working copy of the Hello World Example, and gradually elaborate it. After a bit of experience
you will know what kind of XMl at the start of the Transformation stage will
make life easy. If it is hard to produce it using ESQL, you can consider doing
some preliminary work it in the database, using a database view.

(i.e. Copy the main bits of <Cocoon-Home>/samples/hello-world/ to
<Cocoon-Home>/MyHello-World.
You need:
content/hello.xml
sitemap.xmap with most map:match elements deleted apart from hello.xml, hello.html, hello.txt
style/xsl/page2html.xsl
style/xsl/page2xsl.xml

Unfortunately, the pipeline for hello.xsl has been carefully hidden and is no
longer part of samples/hello-world/sitemap.xmap.

It is now in samples/blocks/poi/sitemap.xmap, but you might as well just copy this
into Myhello-world/sitemap.xmap:


  <map:match pattern="hello.xls">
   <map:generate src="content/hello.xml"/>
   <map:transform src="style/xsl/page2xls.xsl"/>
   <map:serialize type="xls"/>
  </map:match>
Point your browser to:
 http://your/usual/cocoon/url/and/port/Myhello-world/hello.xls

Or if you want differently named source files, use a wildcard:

  <map:match pattern="*.xls">
   <map:generate src="content/{1}.xml"/>
   <map:transform src="style/xsl/page2xls.xsl"/>
   <map:serialize type="xls"/>
  </map:match>

... and use widldcards in all the other pipelines too. Edit hello.xml, or write something similar, and see what difference it makes to the
various styles of output.

You can look at the XML at any stage either by defining a special pipeline, or by defining a Cocoon view. The special pipeline is easier, frankly, if you are a
beginner.



Matthew Monkan wrote:
Hey everyone. I'm somewhat new to XML and Cocoon, so please pardon my
ignorance with the subject. :confused:

I am using Cocoon 2.1.11 on Windows XP. I've been using the Moczar & Aston
book and have been able to create the static page examples in Chapter 7
within the downloaded Cocoon folder.

Ultimately, I need to be able to query info from a database and output an
Excel spreadsheet. Then, I need Cocoon to send out an e-mail with the Excel
spreadsheet attached.

I basically need help understanding what tools in Cocoon I need to use. Can
someone verify these or make suggestions? Here are some of the things I
listed down so far:

For DB to Excel document:

SQLTransformer (queries the database, passing the result back in the SAX
event stream)
HSSF Serializer (turns SAX events into Excel spreadsheet document)

To send out the e-mail:
Cocoon mail block (SendMail Transformer?)

I don't really understand what generator to use. I'm trying to create an
example of this offline using MySQL. So for example, I have a small table
created in MySQL; I want to say, stick some data from it in some shape or
form into Excel, and send out a quick e-mail to a hardcoded e-mail address
with the Excel document attached.

I also need to be able to run this from the offline CLI.

Can someone help me understand the most optimal flow of information I would
use. I want to create a sequence diagram to help me visualize this, so if
someone could help me understand what info is being passed where, that would
be extremely helpful. All the terminology in Cocoon is killing me, and I
need help focusing on what is most important to know for these requirements.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to