1. Modify the XSP page generating XML as follows
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-session="http://apache.org/xsp/session/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<page><title>mydatabasequery</title>
<content>
<esql:connection>
<esql:pool>mydatabase</esql:pool>
<esql:execute-query><esql:query>select * from mytable</esql:query><esql:results>
<esql:row-results>
<para><esql:get-string column="myfield1"/>......<esql:get-string
column="myfield2"/></para>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</content>
</page>
</xsp:page>
--------------------------------------------------------------------------------------------------------
2. Modify the sitemaps to call pass the XML output to the default cocoon
transforms
<map:match pattern="mydatabasequery">
<map:generate type="serverpages" src="mydatabasequery.xsp"/>
<map:transform src="simple-page2fo.xsl"/>
<map:serialize type="fo2pdf"/>
</map:match>
The output won't be great - you'll have to learn how to modify simple-page2fo.xsl to
improve that.
_____________________________________________
Kieran Kirwan
Executive Transportation Planner
Transportation Modelling Department
Dublin Transportation Office
Hainault House,
69/71 St. Stephen's Green,
Dublin 2,
Ireland.
Tel: +353 (0)1 4778113
Fax: +353 (0) 1 478 5935
website: www.dto.ie <http://www.dto.ie/>
-----Original Message-----
From: Ashish Kumar [mailto:[EMAIL PROTECTED]
Sent: 29 October 2003 18:39
To: [EMAIL PROTECTED]
Subject: RE: dynamic pdf generation
hi there,
great!, it was really good help.. i m able to generate the xml
& access it on the browser. but the next thing is, how do i pass this xml
file for xsl & fo tranformation using an xsl file & wat parameteres
should it contain? i can separetly convert an xml to pdf using a seperate
xsl.
thankin again for ur wondrful help
ashish
On Wed, 29 Oct 2003, Kieran Kirwan wrote:
> Assuming you have a database up and running (I'm using MYSQL).
> ....say called mydatabase.....with a table called mytable.....with 2
> fields.....myfield1 and myfield2
>
> 1 Edit COCOON.XCONF as follows
>
> <jdbc name="mydatabase" logger="core.datasources.basedata">
> <pool-controller min="5" max="10"/>
> <auto-commit>false</auto-commit>
> <dburl>jdbc:mysql://localhost:3306/mydatabase</dburl>
> <user>root</user>
> <password/>
> </jdbc>
>
> ---------------------------------------------------------------------------------
> 2 Create an XSP page such as below [mydatabasequery.xsp]
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsp:page language="java"
> xmlns:xsp="http://apache.org/xsp" xmlns:esql="http://apache.org/cocoon/SQL/v2"
> xmlns:xsp-session="http://apache.org/xsp/session/2.0"
> xmlns:xsp-request="http://apache.org/xsp/request/2.0">
>
> <page><title>mydatabasequery</title>
>
> <content>
> <esql:connection>
> <esql:pool>mydatabase</esql:pool>
> <esql:execute-query><esql:query>select * from mytable</esql:query><esql:results>
> <esql:row-results>
> <field1><esql:get-string column="myfield1"/><field1>
> <field2><esql:get-string column="myfield2"/><field2>
> </esql:row-results>
> </esql:results>
> </esql:execute-query>
> </esql:connection>
> </content>
> </page>
>
> </xsp:page>
>
> ---------------------------------------------------------------------------------
> 3 Call from the sitemap
>
> <map:match pattern="mydatabasequery">
> <map:generate type="serverpages" src="mydatabasequery.xsp"/>
> <map:serialize type="xml"/>
> </map:match>
>
>
>
>
>
> _____________________________________________
> Kieran Kirwan
> Executive Transportation Planner
> Transportation Modelling Department
>
> Dublin Transportation Office
> Hainault House,
> 69/71 St. Stephen's Green,
> Dublin 2,
> Ireland.
> Tel: +353 (0)1 4778113
> Fax: +353 (0) 1 478 5935
> website: www.dto.ie <http://www.dto.ie/>
>
>
>
>
> -----Original Message-----
> From: Ashish Kumar [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2003 13:58
> To: [EMAIL PROTECTED]
> Subject: Re: dynamic pdf generation
>
>
> hi there,
> thanx for ur prompt reply, i basically need help in first step, i.e.
> xml output of the database query, i have worked quite a bit
> for later two steps & i know how to do them in cocoon.
> there must be heaps of documentation regarding it but actually i
> have messed up with them and can't find proper info.!
>
> ashish
>
> On Wed, 29 Oct 2003, Derek Hohls wrote:
>
> > ashish
> >
> > Its not clear what you need help with - using various
> > Cocoon and related components you will need to:
> >
> > 1. query the database and return the results as XML (various options)
> > 2. transform the XML to FO (using XSL)
> > 3. serialize the result as PDF (using FOP)
> >
> > All of these steps will need to be sequenced in a pipeline (in the
> > sitemap)
> >
> > Which of the above do you need help with?
> >
> > Derek
> >
> > >>> [EMAIL PROTECTED] 29/10/2003 02:49:09 >>>
> > hi all,
> >
> > where can i find help/documentation for dynamic pdf generation (by
> > quering database)? i m a newbie & can't get much help regarding this
> > thing.
> >
> > ashish
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> > Mailscanner thanks transtec Computers for their support.
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> Mail Marshal for the presence of computer viruses.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
Mail Marshal for the presence of computer viruses.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]