Minimising FOP Runtimes
I have been working on creating a three tier system that per client requests gets data from a database, pumps this into a PDF via FOP XSL/XML processing, then sends the resulting PDF back to the client for display. This project is reaching its end and creating a 3 or 4 page document usually takes 4 or 5 seconds (this is just the FOP processing aspect). Now this is acceptable but there is no harm in hunting down speed improvements. Having read through (and implemented any relevant suggestions) the FOP documentation regarding speed, I thought it would also be a good idea to speak to the people that use this application on a daily basis, as experience is invaluable when it comes to this type of thing. Regards Manuel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: attribute-set
Well I did as you suggested and ran the files through xalan I have included the data files and the xalan outputs below. What seems to be happening is that when FOP/XALAN processes the files rather then but the parameters into the fo:block that calls them it insert into the fo:flow section, so if I do not define an attribute on another block it is overridden with the attribute-set parameters. !-- attribute-set-test.xsl -- fo:flow flow-name=xsl-region-body font-size=10pt xsl:attribute-set name=title_block xsl:attribute name=font-sizexsl:value-of select=report_generics/title_font_size//xsl:attribute xsl:attribute name=font-weightxsl:value-of select=report_generics/title_font_weight//xsl:attribute xsl:attribute name=text-alignxsl:value-of select=report_generics/title_text_align//xsl:attribute /xsl:attribute-set fo:block xsl:use-attribute-sets=title_table_blockTEST USING ATTRIBUTE SET/fo:block fo:block text-align=leftLEFT ALIGN/fo:block fo:block text-align=left font-weight=boldLEFT ALIGN / BOLD/fo:block fo:block text-align=rightRIGHT ALIGN/fo:block fo:block text-align=right font-weight=bold font-size=20ptRIGHT ALIGN / BOLD / 20pt FONT/fo:block /fo:flow !-- attribute-set-test.xml -- ?xml version=1.0 encoding=UTF-8? data report_generics title_font_size10pt/title_font_size title_font_weightbold/title_font_weight title_text_alignright/title_text_align /report_generics /data !-- XALAN output using BOLD in XML data file -- fo:flow font-size=10pt flow-name=xsl-region-body font-weight=bold text-align=right fo:blockTEST USING ATTRIBUTE SET/fo:block fo:block text-align=leftLEFT ALIGN/fo:block fo:block font-weight=bold text-align=leftLEFT ALIGN / BOLD/fo:block fo:block font-weight=bold text-align=rightRIGHT ALIGN / BOLD/fo:block fo:block font-size=20pt font-weight=bold text-align=rightRIGHT ALIGN / BOLD / 20pt FONT/fo:block /fo:flow !-- XALAN output using NORMAL in XML data file -- fo:flow font-size=10pt flow-name=xsl-region-body font-weight=normal text-align=right fo:blockTEST USING ATTRIBUTE SET/fo:block fo:block text-align=leftLEFT ALIGN/fo:block fo:block font-weight=bold text-align=leftLEFT ALIGN / BOLD/fo:block fo:block font-weight=bold text-align=rightRIGHT ALIGN / BOLD/fo:block fo:block font-size=20pt font-weight=bold text-align=rightRIGHT ALIGN / BOLD / 20pt FONT/fo:block /fo:flow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: attribute-set
I just tried moving the xsl:attribute-set/ so that it sat directly below the first and only fo:root/ entry. The hierarchy with these amendments is as follows : xsl:stylesheet - xsl:output - - xsl:template - - - fo:root - - - - xsl:attribute-set - - - - fo:layout-master-set - - - - - fo:simple-page-master - - - - fo:page-sequence - - - - - fo:flow - - - - - - BLOCKS ETC ETC Unfortunately this resulted in exactly the same problem as before (where the xsl:attribute-set/ was defined directly above the block that used it. If I take the xsl:attribute-set/ any higher in the xsl hierarchy I get the following errors in FOP : file:///E:/xsl-fo/attribute-set-test.xsl; Line 6; Column 37; font-size has an illegal attribute: {1} file:///E:/xsl-fo/attribute-set-test.xsl; Line 7; Column 39; font-weight has anillegal attribute: {1} file:///E:/xsl-fo/attribute-set-test.xsl; Line 8; Column 38; text-align has an illegal attribute: {1} Therefore the set isn't defined and everything uses default/defined settings. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
attribute-set
I am having a problem when trying to use attribute sets, and I am unsure on whether this is a problem with FOP or my newbie implementation of the syntax (the most likely possibility) I have the following attribute-set within my document which reads in values from an XML file : xsl:attribute-set name=title_table_block xsl:attribute name=font-sizexsl:value-of select=report_generics/report_title_font_size//xsl:attribute xsl:attribute name=font-weightxsl:value-of select=report_generics/report_title_font_weight//xsl:attribute xsl:attribute name=text-alignxsl:value-of select=report_generics/report_title_text_align//xsl:attribute /xsl:attribute-set Below this I use the following block to define the text within a table cell : fo:block xsl:use-attribute-sets=title_table_block xsl:value-of select=report_generics/report_title/ /fo:block Now from what I understand from these URLs the syntax above is correct : http://www.devguru.com/Technologies/xslt/quickref/xslt_element_attribute set.html http://www.w3schools.com/xsl/el_attributeset.asp The problem is that when I set the text properties it overrides all the font size/weight/align settings defined in other parts of the document, so when I create the PDF all parts of the document use these settings (at the moment this is the only attribute set and this block is the only block that calls it.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Merging XML and FO files
That's great, thanks a lot for those files they more or less cover everything I needed to know. One small thing though, due to the nature of the documents I am creating the ability to create intelligent tables is essential. As an example I have a table called foos in which all my foos are listed, the data being held in a database. Now as the total of foos I have increases (or decreases), I will need to regenerate the table (PDF) and this table needs to look professional. So I need something that will allow me to create dynamic tables that will only contain the amount of rows I need to add the details of the foos in the database. I had a look around on http://www-106.ibm.com/developerworks/xml/ I found some information about basic merging, but nothing on dynamic merges. -Original Message- From: Manjush G. Menon [mailto:[EMAIL PROTECTED] Sent: 20 November 2003 06:45 To: [EMAIL PROTECTED] Subject: Fw: Merging XML and FO files Iam sorry the about the missed attachment. -- Manjush G Menon/\ASCII Ribbon Campaign [EMAIL PROTECTED] \ /Respect for open standards FSC Consultant X No HTML/RTF in email FSC SGB Governing body member / \No M$ Word docs in email - Original Message - From: Manjush G. Menon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 20, 2003 9:18 AM Subject: Re: Merging XML and FO files Hi, Iam using FOP in a similar scenario. As Charles said, its XSLT that you need Please try out the XML/XSL:FO attached. -- Thanks Manjush - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:59 PM Subject: RE: Merging XML and FO files The instructions at this link (http://xml.apache.org/fop/running.html#standalone-start) seem pretty clear to me. I think the piece you are missing is an XSLT stylesheet to convert your XML to XSL-FO. -- Charles Knell [EMAIL PROTECTED] - email -Original Message- From: Manuel Reyes [EMAIL PROTECTED] Sent: Wed, 19 Nov 2003 17:51:51 - To: [EMAIL PROTECTED] Subject: Merging XML and FO files Hello all, I am currently working on an application that will pull data values from a database and place these into an XML file. The resulting XML file is then to be merged with an FO template file and the result would be used to generate a PDF The reason for the mail, is that I wanted to get opinions on the best way to go about doing this. In my minds eye I have the following idea : XML File (containing data values) : merge_test_report field_values value id=@value1abc - 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]
RE: Merging XML and FO files
For anybody who may be searching this list in trying to find the answers to the questions I am asking, this is how it is done : XML File : repeater tubby nameDipsy/name colourGreen/colour /tubby tubby nameLaalaa/name colourRed/colour /tubby tubby namePo/name colourPurple/colour /tubby /repeater XSL File : xsl:for-each select=repeater/tubby fo:block Name : xsl:value-of select=name/ / Colour : xsl:value-of select=colour/ /fo:block /xsl:for-each This will generate the following pdf : Name : Dipsy / Colour : Green Name : Laalaa / Colour : Red Name : Po / Colour : Purple Once again thanks to all those who replied -Original Message- From: Manuel Reyes Sent: 20 November 2003 11:36 To: [EMAIL PROTECTED] Subject: RE: Merging XML and FO files That's great, thanks a lot for those files they more or less cover everything I needed to know. One small thing though, due to the nature of the documents I am creating the ability to create intelligent tables is essential. As an example I have a table called foos in which all my foos are listed, the data being held in a database. Now as the total of foos I have increases (or decreases), I will need to regenerate the table (PDF) and this table needs to look professional. So I need something that will allow me to create dynamic tables that will only contain the amount of rows I need to add the details of the foos in the database. I had a look around on http://www-106.ibm.com/developerworks/xml/ I found some information about basic merging, but nothing on dynamic merges. -Original Message- From: Manjush G. Menon [mailto:[EMAIL PROTECTED] Sent: 20 November 2003 06:45 To: [EMAIL PROTECTED] Subject: Fw: Merging XML and FO files Iam sorry the about the missed attachment. -- Manjush G Menon/\ASCII Ribbon Campaign [EMAIL PROTECTED] \ /Respect for open standards FSC Consultant X No HTML/RTF in email FSC SGB Governing body member / \No M$ Word docs in email - Original Message - From: Manjush G. Menon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 20, 2003 9:18 AM Subject: Re: Merging XML and FO files Hi, Iam using FOP in a similar scenario. As Charles said, its XSLT that you need Please try out the XML/XSL:FO attached. -- Thanks Manjush - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:59 PM Subject: RE: Merging XML and FO files The instructions at this link (http://xml.apache.org/fop/running.html#standalone-start) seem pretty clear to me. I think the piece you are missing is an XSLT stylesheet to convert your XML to XSL-FO. -- Charles Knell [EMAIL PROTECTED] - email -Original Message- From: Manuel Reyes [EMAIL PROTECTED] Sent: Wed, 19 Nov 2003 17:51:51 - To: [EMAIL PROTECTED] Subject: Merging XML and FO files Hello all, I am currently working on an application that will pull data values from a database and place these into an XML file. The resulting XML file is then to be merged with an FO template file and the result would be used to generate a PDF The reason for the mail, is that I wanted to get opinions on the best way to go about doing this. In my minds eye I have the following idea : XML File (containing data values) : merge_test_report field_values value id=@value1abc - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Merging XML and FO files
That's an interesting way of doing this, and will probably come in handy for the documents I need to produce. Thanks a lot. To get the code to work I needed to change this slightly: xsl:template match=repeater xsl:apply-templates select=tubby/ /xsl:template xsl:template match=tubby fo:block Name : xsl:value-of select=repeater/tubby/name/ / Colour : xsl:value-of select=repeater/tubby/colour/ /fo:block /xsl:template What I did find is that this only prints the first tubby value found inside data/repeater. Is there a way to get all the values (I did notice that I could use for-each inside the xsl:template to do this) Regards Manuel -Original Message- From: Chris Adams [mailto:[EMAIL PROTECTED] Sent: 20 November 2003 12:11 To: [EMAIL PROTECTED] Subject: RE: Merging XML and FO files You could have also done it like xsl:template match=repeater xsl:apply-templates select=tubby/ /xsl:template xsl:template match=tubby fo:block Name : xsl:value-of select=name/ / Colour : xsl:value-of select=colour/ /fo:block /xsl:template -Original Message- From: Manuel Reyes [mailto:[EMAIL PROTECTED] Sent: 20 November, 2003 12:08 To: [EMAIL PROTECTED] Subject: RE: Merging XML and FO files For anybody who may be searching this list in trying to find the answers to the questions I am asking, this is how it is done : XML File : repeater tubby nameDipsy/name colourGreen/colour /tubby tubby nameLaalaa/name colourRed/colour /tubby tubby namePo/name colourPurple/colour /tubby /repeater XSL File : xsl:for-each select=repeater/tubby fo:block Name : xsl:value-of select=name/ / Colour : xsl:value-of select=colour/ /fo:block /xsl:for-each This will generate the following pdf : Name : Dipsy / Colour : Green Name : Laalaa / Colour : Red Name : Po / Colour : Purple Once again thanks to all those who replied -Original Message- From: Manuel Reyes Sent: 20 November 2003 11:36 To: [EMAIL PROTECTED] Subject: RE: Merging XML and FO files That's great, thanks a lot for those files they more or less cover everything I needed to know. One small thing though, due to the nature of the documents I am creating the ability to create intelligent tables is essential. As an example I have a table called foos in which all my foos are listed, the data being held in a database. Now as the total of foos I have increases (or decreases), I will need to regenerate the table (PDF) and this table needs to look professional. So I need something that will allow me to create dynamic tables that will only contain the amount of rows I need to add the details of the foos in the database. I had a look around on http://www-106.ibm.com/developerworks/xml/ I found some information about basic merging, but nothing on dynamic merges. -Original Message- From: Manjush G. Menon [mailto:[EMAIL PROTECTED] Sent: 20 November 2003 06:45 To: [EMAIL PROTECTED] Subject: Fw: Merging XML and FO files Iam sorry the about the missed attachment. -- Manjush G Menon/\ASCII Ribbon Campaign [EMAIL PROTECTED] \ /Respect for open standards FSC Consultant X No HTML/RTF in email FSC SGB Governing body member / \No M$ Word docs in email - Original Message - From: Manjush G. Menon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 20, 2003 9:18 AM Subject: Re: Merging XML and FO files Hi, Iam using FOP in a similar scenario. As Charles said, its XSLT that you need Please try out the XML/XSL:FO attached. -- Thanks Manjush - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:59 PM Subject: RE: Merging XML and FO files The instructions at this link (http://xml.apache.org/fop/running.html#standalone-start) seem pretty clear to me. I think the piece you are missing is an XSLT stylesheet to convert your XML to XSL-FO. -- Charles Knell [EMAIL PROTECTED] - email -Original Message- From: Manuel Reyes [EMAIL PROTECTED] Sent: Wed, 19 Nov 2003 17:51:51 - To: [EMAIL PROTECTED] Subject: Merging XML and FO files Hello all, I am currently working on an application that will pull data values from a database and place these into an XML file. The resulting XML file is then to be merged with an FO template file and the result would be used to generate a PDF The reason for the mail, is that I wanted to get opinions on the best way to go about doing this. In my minds eye I have the following idea : XML File (containing data values) : merge_test_report field_values value id=@value1abc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Merging XML and FO files
Hello all, I am currently working on an application that will pull data values from a database and place these into an XML file. The resulting XML file is then to be merged with an FO template file and the result would be used to generate a PDF The reason for the mail, is that I wanted to get opinions on the best way to go about doing this. In my minds eye I have the following idea : XML File (containing data values) : merge_test_report field_values value id=@value1abc/value value id=@value2def/value /field_values repeat_values repeater id=1 values value id=@mvalue1rep 1a/value value id=@mvalue2rep 1b/value /values /repeater values value id=@mvalue1rep 2a/value value id=@mvalue2rep 2b/value /values /repeater repeat_values merge_test_report FO File (containing the base layout for the pdf) : fo:table table-layout=fixed fo:table-column column-width=10cm/ fo:table-body fo:table-row fo:table-cell fo:block text-align=left@value1 / @value2/fo:block /fo:table-cell /fo:table-row !-- STARTREPEATMERGE id=1 -- fo:table-row fo:table-cellfo:block@mvalue1 / @mvalue2/fo:block/fo:table-cell /fo:table-row !-- ENDREPEATMERGE id=1 -- /fo:table-body I would then create an application to read through the XML file and place its values into the FO template, which would create another FO file which would be processed by FOP. This would generate a PDF with something similar to this format : abc / def rep1a / rep 1b rep2a / rep 2b Considering I currently have about 4 hours experience of FOP and XSL-FO I am insure on whether this is the best way to proceed, or if FOP has any functionality that will make my life easier - bearing in mind the ability to create repeated tables is a must. I noticed from looking at the command line parameters for fop that there is an option for : Fop -xsl foo.xsl -xml foo.xml -pdf foo.pdf Which leads me to believe that fop may already have what I need; unfortunately I can seem to pin down the documentation/samples covering that functionality. Regards Manuel Reyes PS. The XML/XSL above may not be 100% correct, as it was just typed quickly into the message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]