RE: FopServlet

2005-03-11 Thread Ben Gill
Are you not creating an XML file on disk with this version with:

else if ((xmlParam != null)  (xslParam != null)) {
Source src = new StreamSource(new File(xmlParam));

I think it would be good to include an example of how to generate the PDF
from a ProjectTeam without touching the disk?

Ben


-Original Message-
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: 11 March 2005 08:26
To: [EMAIL PROTECTED]
Subject: Re: FopServlet


Here's a modified version of the servlet:
http://cvs.apache.org/~jeremias/FopServlet.java

BTW, while updating the file I found an opportunity for a little
optimization. In the servlet's case the ByteArrayOutputStream should not
be instantiated with the default constructor. This only allocates 64
bytes initially. Every time the buffer runs out of space the old buffer
is discarded and a new one with twice the previous space is allocated.
If you do new ByteArrayOutputStream(16384) (or an even higher number
depending on the documents you serve), you will get a slight performance
improvement almost for free. :-)

On 10.03.2005 13:02:22 Ben Gill wrote:
 Maybe the example can be updated with my version?  I have not compiled
this,
 but I know it works...



Jeremias Maerki


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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus 
Control Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. Please note that it is your responsibility to scan 
this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*

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



RE: FopServlet

2005-03-11 Thread Ben Gill
);

Driver driver = new Driver();
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);

//Setup XSLT
if (factory == null) {
factory = TransformerFactory.newInstance();
}
Transformer transformer;
if (xslt != null) {
transformer = factory.newTransformer(xslt);
} else {
transformer = factory.newTransformer();
}

//Resulting SAX events (the generated FO) must be piped through
to FOP
Result res = new SAXResult(driver.getContentHandler());

//Start XSLT transformation and FOP processing
transformer.transform(src, res);

byte[] content = out.toByteArray();
//log.debug(Created PDF:  + content.length);
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
} catch (Exception ex) {
throw new ServletException(ex);
}
}

}

and the simplest way to sort the build.xml file is to add this to
servlet/build.xml:

  property name=embedding.src.dir value=./../embedding/java/

  !-- ===
--
  !-- Compiles the source directory
--
  !-- ===
--
  target name=compile depends=prepare
echo message=Compiling the sources /
javac srcdir=${embedding.src.dir} destdir=${build.dest}
debug=${debug} deprecation=${deprecation} optimize=${optimize}
  classpath refid=project.class.path/
/javac

javac srcdir=${src.dir} destdir=${build.dest} debug=${debug}
deprecation=${deprecation} optimize=${optimize}
  classpath refid=project.class.path/
/javac
  /target

Ben



-Original Message-
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: 11 March 2005 10:10
To: [EMAIL PROTECTED]
Subject: Re: FopServlet


The modified servlet has the same functionality as the example servlet
in the distribution. You're welcome to do the example involving the
ProjectTeam yourself. I don't have the time.

On 11.03.2005 11:06:59 Ben Gill wrote:
 Are you not creating an XML file on disk with this version with:
 
 else if ((xmlParam != null)  (xslParam != null)) {
 Source src = new StreamSource(new File(xmlParam));
 
 I think it would be good to include an example of how to generate the PDF
 from a ProjectTeam without touching the disk?
 
 Ben
 
 
 -Original Message-
 From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
 Sent: 11 March 2005 08:26
 To: [EMAIL PROTECTED]
 Subject: Re: FopServlet
 
 
 Here's a modified version of the servlet:
 http://cvs.apache.org/~jeremias/FopServlet.java
 
 BTW, while updating the file I found an opportunity for a little
 optimization. In the servlet's case the ByteArrayOutputStream should not
 be instantiated with the default constructor. This only allocates 64
 bytes initially. Every time the buffer runs out of space the old buffer
 is discarded and a new one with twice the previous space is allocated.
 If you do new ByteArrayOutputStream(16384) (or an even higher number
 depending on the documents you serve), you will get a slight performance
 improvement almost for free. :-)
 
 On 10.03.2005 13:02:22 Ben Gill wrote:
  Maybe the example can be updated with my version?  I have not compiled
 this,
  but I know it works...
 
 
 
 Jeremias Maerki
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 _
 This message has been checked for all known viruses by the 
 MessageLabs Virus Control Centre.
 
 This message has been checked for all known viruses by the MessageLabs
Virus Control Centre.
 
   
 *
 
 Notice:  This email is confidential and may contain copyright material of
Ocado Limited (the Company). Opinions and views expressed in this message
may not necessarily reflect the opinions and views of the Company.
 If you are not the intended recipient, please notify us immediately and
delete all copies of this message. Please note that it is your
responsibility to scan this message for viruses.
 
 Company reg. no. 3875000.
 Ocado Limited
 Titan Court
 3 Bishops Square
 Hatfield Business Park
 Hatfield
 Herts
 AL10 9NE
 
 
 *
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED

RE: FopServlet

2005-03-10 Thread Ben Gill
Hi,

ok I tried it again and get the same exception!!

Here is my code (well I have given you the equiv with project team!):

public void execute(HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException {

try {
ProjectTeam projectTeam = new ProjectTeam();

// set up the logger for the driver
if (logger==null) {
logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
MessageHandler.setScreenLogger(logger);
}
MessageHandler.setScreenLogger(logger);
 
File xslFile = new File(./../myxsl, projectTeam2FO.xsl);
SAXSource xmlSource = new SAXSource(new IncidentsXMLReader(),
new IncidentsInputSource(projectTeam));

SAXSource xslSource = new SAXSource(
new InputSource(new FileInputStream(xslFile)));

TraxInputHandler input =
new TraxInputHandler(xmlSource.getInputSource(),
 xslSource.getInputSource());

renderXML(input, response);

} catch (ServletException ex) {
throw ex;
}
catch (Exception e) {
throw new ServletException(e);
}
}

public void renderXML(TraxInputHandler input,
  HttpServletResponse response) throws
ServletException {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();

response.setContentType(application/pdf);

Driver driver = new Driver();
driver.setLogger(logger);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
input.run(driver);

byte[] content = out.toByteArray();
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
} catch (Exception ex) {
throw new ServletException(ex);
}
}


and here is the stack trace:

2005-03-10 07:40:21 StandardContext[/tracker]:  Mapped to servlet 'fop' with
servlet path '/fop' and path info 'null' and update=true
2005-03-10 07:40:23 StandardWrapperValve[fop]: Servlet.service() for servlet
fop threw exception
javax.servlet.ServletException: java.net.MalformedURLException
at
com.ocado.tracker.common.FopServlet.renderXML(FopServlet.java:150)
at com.ocado.tracker.common.FopServlet.execute(FopServlet.java:116)
at com.ocado.tracker.common.FopServlet.doGet(FopServlet.java:56)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:200)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:146)
at
org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterIn
ternal(OpenSessionInViewFilter.java:171)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestF
ilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:166)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:146)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:209)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:596)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:144)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:596)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:445)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:594)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:596)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:118)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:594)
at

RE: FopServlet

2005-03-10 Thread Ben Gill
Right, I have got it working!

Thanks for your help Jeremias - you were right about input.run() running in
my test (which was the old way - which was causing the error!)..  the key
was to use the ExampleObj2PDF logic in the servlet...

Maybe the example can be updated with my version?  I have not compiled this,
but I know it works...

Here is :

public void execute(HttpServletRequest request, HttpServletResponse
response)
throws IOException, ServletException {

ByteArrayOutputStream out = null;

try {
ProjectTeam projectTeam = new ProjectTeam();
projectTeam.setProjectName(test);

Driver driver = new Driver();
Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
driver.setLogger(logger);
MessageHandler.setScreenLogger(logger);
driver.setRenderer(Driver.RENDER_PDF);

out = new ByteArrayOutputStream();
driver.setOutputStream(out);

File xslFile = new
File(./../webapps/myappname/WEB-INF/classes/mypkgname/fop,
projectteam2fo.xsl);

//Setup XSLT
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new
StreamSource(xslFile));

//Setup input for XSLT transformation
Source src = incident.getSource();

//Resulting SAX events (the generated FO) must be piped through
to FOP
Result res = new SAXResult(driver.getContentHandler());

//Start XSLT transformation and FOP processing
transformer.transform(src, res);

byte[] content = out.toByteArray();
response.setContentType(application/pdf);
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();

} catch (Exception e) {
throw new ServletException(e);
} finally {
if (out!=null) {
out.close();
}
}
}

Regards




-Original Message-
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: 10 March 2005 11:03
To: [EMAIL PROTECTED]
Subject: Re: FopServlet


Does the problem persist if you serialize the SAX events generated by
the Incident with an identity transformer to a file and run the XSL
transformation stand-alone from the command-line?

I don't think it's a problem but did you realize that you have two FOP
processing runs in your testGeneratePDF() method, the first started by
Transformer.transform() and the other by input.run()? Since I can't do
anything with the line numbers in the stack trace, this is something you
have to do.

On 10.03.2005 11:12:07 Ben Gill wrote:
 
 
 -Original Message-
 From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
 Sent: 10 March 2005 09:37
 To: [EMAIL PROTECTED]
 Subject: Re: FopServlet
 
 
 
 On 10.03.2005 08:49:26 Ben Gill wrote:
  Hi,
  
  ok I tried it again and get the same exception!!
  
  Here is my code (well I have given you the equiv with project team!):
 
 snip/
 
 Hmm, you are still using the InputHandler approach which I personally
 don't consider ideal. I'd integrate the renderXML() method into the main
 execute method and use the pattern from ExampleObj2PDF 1:1. But I can't
 tell if your problem has something to do with that. Probably not.
 
 Ok, I tried this and still get the same error... I have created a Junit
test
 for this and here is my code, based upon the ExampleObj2PDF example:
 
  public void testGeneratePDF() throws Exception {
   try {
   Incident incident = incidentsDAO.loadIncident(new
 Long(121));
   
   
   File baseDir = new File(.);
   File outDir = new File(baseDir, out);
   outDir.mkdirs();
   
   File xslFile = new File(baseDir,
 ../source/src/com/ocado/tracker/incidents/fop/incident2FO.xsl);
   
   Driver driver = new Driver();
   Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
   driver.setLogger(logger);
   MessageHandler.setScreenLogger(logger);
   driver.setRenderer(Driver.RENDER_PDF);
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   
   try {
   
   driver.setOutputStream(out);
   
 //Setup XSLT
 TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(new
 StreamSource(xslFile));
 
 //Setup input for XSLT transformation
 Source src = incident.getSource();
 
 //Resulting SAX events (the generated FO) must

xsl:apply-templates

2005-03-10 Thread Ben Gill
Hi,

I am using apply-templates, but would like to always spit out one child
(ie.TeamMemeber) entry in the PDF doc.

At the momment, if there is no TeamMember, nothing gets written to the PDF
document..

Is there a clever way of telling XSL to spit out at least one child anyway?
or is the solution to 
dump out some empty XML from the ProjectTeamXMLReader?

Thanks


This message has been checked for all known viruses by the MessageLabs Virus 
Control Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. Please note that it is your responsibility to scan 
this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*

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



FopServlet

2005-03-09 Thread Ben Gill
Hi,

I am trying to use the FopServlet, but ideally, dont want to have to produce
the XML file on disk, and then load it up again, just to pass in File, File
into XSLTHandler (or TraxInputHandler)...

So, I was trying to just pass in InputSources..(ie):

ProjectTeam projectTeam = new ProjectTeam();
InputSource projectTeamInputSource = new
ProjectTeamInputSource(projectTeam);

Is this possible?  or do I *have* to save the XML to disk?

(I was getting a malformed URL exception when trying to do this)

Ben

This message has been checked for all known viruses by the MessageLabs Virus 
Control Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. Please note that it is your responsibility to scan 
this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*

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



RE: FopServlet

2005-03-09 Thread Ben Gill



Thanks

That 
is what I have done as well (except saved them locally to the webapp - as had 
bad experiences before with Swap space running out when using 
/tmp!!)...

I read 
a few other posts around, where people got this MalformedURLException when 
trying to do this...

But as 
you say - it works this way so I am not going to lose too much sleep over it! 
:)

  -Original Message-From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]Sent: 09 March 2005 
  15:31To: [EMAIL PROTECTED]Subject: Re: 
  FopServlet
  Ben
  
  I tried without creating a file on disk but was not successful but then I 
  might have missed something. If disk space is an issue ( like in my case) , I 
  created them in the /tmp directory on Unix where my server was running. The 
  /tmp directory gets cleaned up et end of day and so that solved my 
  problem..
  
  Thanks
  Manoj
  -Ben Gill 
  [EMAIL PROTECTED] wrote: -To: 
  "'[EMAIL PROTECTED]'" [EMAIL PROTECTED]From: Ben Gill 
  [EMAIL PROTECTED]Date: 03/09/2005 02:02AMSubject: 
  FopServletHi,I am trying to use 
  the FopServlet, but ideally, dont want to have to producethe XML file on 
  disk, and then load it up again, just to pass in File, Fileinto 
  XSLTHandler (or TraxInputHandler)...So, I was trying to just pass in 
  InputSources..(ie):ProjectTeam projectTeam = new 
  ProjectTeam();InputSource projectTeamInputSource = 
  newProjectTeamInputSource(projectTeam);Is this possible? or 
  do I *have* to save the XML to disk?(I was getting a malformed URL 
  exception when trying to do this)BenThis message has been 
  checked for all known viruses by the MessageLabs Virus Control 
  Centre. 
  *Notice: 
  This email is confidential and may contain copyright material of Ocado 
  Limited (the "Company"). Opinions and views expressed in this message may not 
  necessarily reflect the opinions and views of the Company.If you are not 
  the intended recipient, please notify us immediately and delete all copies of 
  this message. Please note that it is your responsibility to scan this message 
  for viruses.Company reg. no. 3875000.Ocado LimitedTitan 
  Court3 Bishops SquareHatfield Business 
  ParkHatfieldHertsAL10 
  9NE*-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 
  message has been checked for all known viruses by the MessageLabs Virus 
  Control Centre.

This message has been checked for all known viruses by the MessageLabs Virus Control Centre.

	
*

Notice:  This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*




Pretty XML!

2005-03-08 Thread Ben Gill
Hi,

I have generated my XML using the EasyGenerationContentHandlerProxy (via
AbstractObjectReader), and the XML generated is not formatted (no line
breaks
between elements etc..)...

What is the best way to achieve properly (4 spaces?) indented xml?

It would just be easier to read whilst debugging...

Thanks

This message has been checked for all known viruses by the MessageLabs Virus 
Control Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. Please note that it is your responsibility to scan 
this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*

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



Error:

2005-03-07 Thread Ben Gill
Hi,

I downloaded the latest 0.20.5 bin and copied the ExampleObj2PDF example and
am getting:

{ERROR} dao.BaseDAOTestCase  Error generating PDF document
[org.apache.fop.apps.
FOPException: root must be root element]
javax.xml.transform.TransformerException: org.apache.fop.apps.FOPException:
root
 must be root element
at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
t.java:725)
at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(
ElemApplyTemplates.java:425)
at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTempla
tes.java:216)
at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
ansformerImpl.java:2339)
at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
sformerImpl.java:2160)
at
org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
rImpl.java:1213)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:668)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1129)
at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1107)


from XLST stylesheet:

?xml version=1.0 encoding=UTF-8?
xsl:stylesheet version=1.1 
xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
xmlns:fo=http://www.w3.org/1999/XSL/Format; 
exclude-result-prefixes=fo
  xsl:output method=xml version=1.0 omit-xml-declaration=no
indent=yes/
  !-- = --
  !-- root element: projectteam --
  !-- = --
  xsl:template match=incident
fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
  fo:layout-master-set
fo:simple-page-master master-name=simpleA4 page-height=29.7cm 
page-width=21cm margin-top=2cm
margin-bottom=2cm margin-left=2cm margin-right=2cm
  fo:region-body/
/fo:simple-page-master
  /fo:layout-master-set
  fo:page-sequence master-reference=simpleA4
fo:flow flow-name=xsl-region-body
  fo:block font-size=16pt font-weight=bold
space-after=5mmIncident Type: 
xsl:value-of select=incident/
  /fo:block
  fo:block font-size=10pt
fo:table table-layout=fixed
  fo:table-column column-width=4cm/
  fo:table-column column-width=4cm/
  fo:table-column column-width=5cm/
  fo:table-body
xsl:apply-templates/
  /fo:table-body
/fo:table
  /fo:block
/fo:flow
  /fo:page-sequence
/fo:root
  /xsl:template
  !-- = --
  !-- child element: member --
  !-- = --
!--
  xsl:template match=member
fo:table-row
  xsl:if test=function = 'lead'
xsl:attribute name=font-weightbold/xsl:attribute
  /xsl:if
  fo:table-cell
fo:block
  xsl:value-of select=name/
/fo:block
  /fo:table-cell
  fo:table-cell
fo:block
  xsl:value-of select=function/
/fo:block
  /fo:table-cell
  fo:table-cell
fo:block
  xsl:value-of select=email/
/fo:block
  /fo:table-cell
/fo:table-row
  /xsl:template
--
/xsl:stylesheet


Can anyone help or tell me how to get more info out of FOP?   (ie. some
DEBUG trace?) or even how to get hold of the generated FO file?

Thanks



This message has been checked for all known viruses by the MessageLabs Virus 
Control Centre.


*

Notice:  This email is confidential and may contain copyright material of Ocado 
Limited (the Company). Opinions and views expressed in this message may not 
necessarily reflect the opinions and views of the Company.
If you are not the intended recipient, please notify us immediately and delete 
all copies of this message. Please note that it is your responsibility to scan 
this message for viruses.

Company reg. no. 3875000.
Ocado Limited
Titan Court
3 Bishops Square
Hatfield Business Park
Hatfield
Herts
AL10 9NE


*

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



RE: Error:

2005-03-07 Thread Ben Gill
Thats great... thanks for your help

-Original Message-
From: Jeremias Maerki [mailto:[EMAIL PROTECTED]
Sent: 07 March 2005 14:41
To: [EMAIL PROTECTED]
Subject: Re: Error:


Do the following: Instead of piping the result of the XSL transformation
through to FOP with the following line:

Result res = new SAXResult(driver.getContentHandler());

...simply serialize the resulting XSL-FO document to a file:

Result res = new StreamResult(new File(C:/Temp/debug.fo));

Check if the FO file looks right and runs smoothly through FOP.

To debug the whole thing outside of your application you might want to
consider writing the early XML to a file. In this case your code would
look like in [1]. Note the identity transformer instead of an XSL
transformation. In this case you'd have a Result like this:

Result res = new StreamResult(new File(C:/Temp/debug.xml));

Once you have the XML from your application, you can use xalan.bat, fop.bat
and your stylesheet to debug everything. Once your stylesheet is fixed
you can run the integrated code again that does the full functionality.
The key is to break down the whole process into it parts (creating XML
from your application, transforming using XSLT and formatting using FOP).

[1]
http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/
ExampleObj2XML.java?rev=1.4


On 07.03.2005 15:27:21 Ben Gill wrote:
 Thanks Chris,
 
 This helped me sort out the problem straight away  The xalan.bat will
 help me a lot in debugging...
 
 But this is not going to show me anything too useful as I am populating
 Object straight to PDF...
 
 As the Object to PDF generation process, includes generating the XML and
the
 FO syntax (at some point during the processing - I assume at least)... is
 there any way to get this information by switching on some sort of FOP
 debugging?  
 
 That would be really useful (and will probably save me a lot of
time!!)
 
 Cheers
 
 -Original Message-
 From: Chris Bowditch [mailto:[EMAIL PROTECTED]
 Sent: 07 March 2005 14:04
 To: [EMAIL PROTECTED]
 Subject: Re: Error:
 
 
 Ben Gill wrote:
 
  Hi,
  
  I downloaded the latest 0.20.5 bin and copied the ExampleObj2PDF example
 and
  am getting:
  
  {ERROR} dao.BaseDAOTestCase  Error generating PDF document
  [org.apache.fop.apps.
  FOPException: root must be root element]
  javax.xml.transform.TransformerException:
 org.apache.fop.apps.FOPException:
  root
   must be root element
 
 This is a problem with your XML/XSLT
 
 snip/
 
  
  from XLST stylesheet:
  
  ?xml version=1.0 encoding=UTF-8?
  xsl:stylesheet version=1.1 
  xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
  xmlns:fo=http://www.w3.org/1999/XSL/Format; 
  exclude-result-prefixes=fo
xsl:output method=xml version=1.0 omit-xml-declaration=no
  indent=yes/
!-- = --
!-- root element: projectteam --
!-- = --
xsl:template match=incident
 
 Note, that the element being matched differs from the comment. However,
this
 
 may not be the cause of the problem. Most likely cause is several
 occurrences 
 of element incident in your source XML, resulting in several root
elements.
 
 To determine where mistake is you should generate XSL-FO file by running 
 xalan.bat (in FOP distribution) from command line.
 
 snip/
 
 Chris
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 _
 This message has been checked for all known viruses by the 
 MessageLabs Virus Control Centre.
 
 This message has been checked for all known viruses by the MessageLabs
Virus Control Centre.
 
   
 *
 
 Notice:  This email is confidential and may contain copyright material of
Ocado Limited (the Company). Opinions and views expressed in this message
may not necessarily reflect the opinions and views of the Company.
 If you are not the intended recipient, please notify us immediately and
delete all copies of this message. Please note that it is your
responsibility to scan this message for viruses.
 
 Company reg. no. 3875000.
 Ocado Limited
 Titan Court
 3 Bishops Square
 Hatfield Business Park
 Hatfield
 Herts
 AL10 9NE
 
 
 *
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



Jeremias Maerki


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


_
This message has been checked for all known viruses by the 
MessageLabs Virus Control Centre