cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: XML to Excel template examples Required.
Date Thu, 19 Jul 2007 11:15:25 GMT
Siddhu
 
OK - I downloaded and installed the app on my machine.
 
The area you need to look at is around line 240 in the sitemap.
 
If you change to:
 
     <!-- Serialize into format suitable for Excel 
    <map:serialize type="excel-serializer"/>-->
 
     <!-- DEBUG: Convert into character stream-->
      <map:serialize type="xml"/> 
 
Then you will what the XML looks like before the serializer
gets hold of it and creates the XLS (this will be Java code located
in the directory ....WEB-INF\classes\com\clsw\cocoon).
 
Basically, it consists of a header element:
<rpt:template-path>[path]/template.xls</rpt:template-path> 
to tell it where to find the template as well as lots of:
 
<rpt:add type="java.lang.Double" col="2" row="5">14.59</rpt:add> 
cell entry values.
 
All of this info is generated from the database in these steps here:
 
 <map:match pattern="report/*.xls">
    <map:generate type="request"/>
    <map:transform type="xslt" src="render-logic.xsl">
     <map:parameter name="label" value="{1}"/>
    </map:transform>
    <map:transform type="xinclude"/>
    <map:transform type="xslt" src="render-logic.xsl"/>
    <map:transform type="sql">
     <map:parameter name="dburl" value="jdbc:mysql://localhost/test"
/>
    </map:transform>
    <map:transform type="xslt" src="render-logic2.xsl">
     <map:parameter name="label" value="{1}"/>
     <map:parameter name="absolute-path"
value="D:/tomcat/webapps/cocoon-reports"/> 
    </map:transform>
 
and you can omit *all* these stages if you have an existing XML file.
 
Use something more like:
 
<map:match pattern="report/*.xls">
  <map:generate src="myDirectory/myData.xml"/>
  <map:transform type="xslt" src="myXML2reportXML.xsl">
 
You will need to write the XSL to transform from the XML layout you
have
into the format needed (as I discussed above). 
 
If you do not know how to write XSL, you will really need to spend time

doing that before you can work with Cocoon - there is an XSLT mailing
list
that can help if you get stuck with syntax.
 
Derek

>>> fast-flux <000010sg@gmail.com> 2007/07/19 11:00 AM >>>


Hi Derek,

Thanks for the reply...  I went through an article over web
(http://www.xml.com/lpt/a/1096). Here I see that folks have used
cocoon-report.war where we provide a schema.xml and Excel template.
There
are couple of XSL files (render-logic.xsl, render-logic1.xsl) which
does
pull the data from a MySQL database and populate the predefined excel
template.

I am looking for the same but instead have database as the source I
needed
an XML. I am trying to simulate the same functionality which is
mentioned in
the article, but I am not able to figure out how the predefined Excel
template is getting populated. 

Any pointers towards this?


Thanks,
Siddhu.


Derek Hohls wrote:
> 
> Siddhu
>  
> Your use of the word "template" is confusing; XSL files are not
> templates and, AFAIK, you cannot open and write to an existing
> Excel file (if that is actually what you are trying to do) using
> Cocoon
> as it stands.  Perhaps someone else on the list knows how to do
this?
> 
>>>> fast-flux <000010sg@gmail.com> 2007/07/19 09:07 AM >>>
> 
> 
> Hi,
> 
> I have tried the examples that you guys ask me to try. The problem
here
> is,
> all these explain creating a new XLS sheet and not use existing XLS
> sheet as
> a template and generate a response.
> 
> I am trying to use a existing template and use some kind of mapping
> from the
> XML field names to the columns in the template and generate the
entire
> xls
> out.
> 
> Is there any way to do this?
> 
> Thanks,
> Siddhu
> 
> 
> Derek Hohls wrote:
>> 
>> Siddhu
>>  
>> Its not clear what you do know or don't know how to do.
>>  
>> As a beginner in Cocoon I always found it helpful to look at the
>> samples shipped with Cocoon and adapt them to aid learning.
>>  
>> For example, look at the "XLS" example in the "Hello World" group:
>> http://localhost:8080/cocoon/samples/hello-world/ 
>> or under
>> [path-to-cocoon]\build\webapp\samples\blocks\poi
>> AND
>> [path-to-cocoon]\build\webapp\samples\hello-world
>>  
>> No SQL, just plain XSLT and the POI serializer.
>> 
>>>>> fast-flux <000010sg@gmail.com> 2007/07/19 08:39:18 AM >>>
>> 
>> 
>> Hi All,
>> 
>> I am just beginner in cocoon. I have the following requirements:
>> 
>> 1.    I have input XML file
>> <Cars>
>> <Car>
>>           <name>
>>                 Ferrari
>>            </name>
>>            <type>
>>                 Water
>>            </type>
>> </Car>
>> <Car>
>>            <name>
>>                 Mercedes
>>            </name>
>>            <type>
>>                 Air
>>            </ type>
>> </Car>
>> </Cars>
>> 
>> 
>> 2.    I have a Excel template Which already has headers (Car Name &

>> Car
>> Type)
>> 
>> 
>> Task for me is to use the XML as a source generater & serilize the
>> output using the predefined template.
>> 
>> I would appreciate if you could share any working example of such
>> type.
>> 
>> I visited XML.com article ( http://www.xml.com/lpt/a/1096 ) and
they
>> have
>> no examples where we can take the input feed from XML and generate
> on
>> a
>> Template. All example includes SQL and due to some freak problem, I
> am
>> still struggling to get the SQL part running.
>> 
>> Thanks in advance,
>> -Siddhu
>> -- 
>> View this message in context:
>>
>
http://www.nabble.com/XML-to-Excel-template-examples-Required.-tf4108469.html#a11683207

> 
>> 
>> Sent from the Cocoon - Users mailing list archive at Nabble.com.
>> 
>> 
>>
>
---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>> For additional commands, e-mail: users-help@cocoon.apache.org 
>> 
>> 
>> 
>> -- 
>> This message is subject to the CSIR's copyright, terms and
conditions
> and
>> e-mail legal notice. Views expressed herein do not necessarily
> represent
>> the
>> views of the CSIR.
>>  
>> CSIR E-mail Legal Notice
>> http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
>>  
>> CSIR Copyright, Terms and Conditions
>> http://mail.csir.co.za/CSIR_Copyright.html 
>>  
>> For electronic copies of the CSIR Copyright, Terms and Conditions
and
> the
>> CSIR
>> Legal Notice send a blank message with REQUEST LEGAL in the subject
> line
>> to
>> CallCentre@csir.co.za.
>> 
>> 
>> This message has been scanned for viruses and dangerous content by
>> MailScanner, 
>> and is believed to be clean.
>> 
>> 
>>
>
---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
>> For additional commands, e-mail: users-help@cocoon.apache.org 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/XML-to-Excel-template-examples-Required.-tf4108469.html#a11683455

> 
> Sent from the Cocoon - Users mailing list archive at Nabble.com.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 
> 
> 
> -- 
> This message is subject to the CSIR's copyright, terms and conditions
and
> e-mail legal notice. Views expressed herein do not necessarily
represent
> the
> views of the CSIR.
>  
> CSIR E-mail Legal Notice
> http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
>  
> CSIR Copyright, Terms and Conditions
> http://mail.csir.co.za/CSIR_Copyright.html 
>  
> For electronic copies of the CSIR Copyright, Terms and Conditions and
the
> CSIR
> Legal Notice send a blank message with REQUEST LEGAL in the subject
line
> to
> CallCentre@csir.co.za.
> 
> 
> This message has been scanned for viruses and dangerous content by
> MailScanner, 
> and is believed to be clean.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
> For additional commands, e-mail: users-help@cocoon.apache.org 
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/XML-to-Excel-template-examples-Required.-tf4108469.html#a11684855

Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org 
For additional commands, e-mail: users-help@cocoon.apache.org 



-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
 
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 
 
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 
 
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
CallCentre@csir.co.za.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message