Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
Hi, Can't you use multiple page-sequences instead of just creating one sequence 'interrupted' by the 'ctrlPage' template? but How? this template is more difficult since it is used in with a more complicated XML like groupproduct/.../group..., the way that I sent is for brevety to discover because ctrlPage don't work, for groups I need print a header, followed by products, etc..., in original XSL i use xalan extensions to count how many lines I used PDF. A few remarks to help you on your way: 1. I can't seem to find the reason why you are placing the whole fo:static-content into a separate template, since it is ... well, static and it doesn't rely on the elements in the XML (unless something is missing). because, I reduced the code for brevety, then the static-content is for groups case. sorry 2. In the ctrlPage template, you are testing for a position(): you could also use XPath to select these, like xsl:apply-templates select=product[(position() mod 3) = 0] Then inside the product template, use xsl:for-each select=preceding::product[position() 3] / to grab the two preceding product nodes. but for-each select don't put Xalan in DOM process? consumes more memory? however I can't use position because the original XML is more complex. (I use xalan extensions to control this). like this xsl:if test=counter:read('ctLine') mod 3/xsl:if 3. Check our http://xml.apache.org/fop/resources.html page, among the books and articles, there's a link to Dave Pawson's XSLT FAQ. Over there, you'll find a lot of useful stuff (amongst others on grouping which I think you'll find particularly helpful), so I'll bet you can work out a redesign which affects only the XSL itself and leaves the other files alone. If you really can't get any further, try posting your problem on Mulberry's XSLT list. Warning: it's a quite high-traffic list, but the upside is that the tips are 'highly-usable' ;) Hope this helps! Cheers, Andreas Thanks for tips Clovis
Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
On 09.01.2004 18:29:14 Clóvis Wichoski wrote: snip/ xsl:template name=ctrlPage xsl:if test=(position() mod 3) = 0 xsl:text disable-output-escaping=yes![CDATA[/fo:flow/fo:page-sequencefo:page-sequence master-reference=A4 language=pt country=br]]/xsl:text xsl:call-template name=header/ xsl:text disable-output-escaping=yes![CDATA[fo:flow flow-name=xsl-region-body]]/xsl:text /xsl:if /xsl:template The problem is that you put some XML code into a CDATA section. On-the-fly processing works with SAX. And in SAX your code will be delivered as text instead of as elements. snip/ I can't understand because on the fly don't woks and from .fo file generated from xml+xsl transformation work, maybe a bug of FOP, or I can't generate XML elements using CDATA from this form. The latter. I post this in dev list because I think that this is a feature or a bug on FOP then I attached the XSL and XML files that the team can test this issue, and the code is better to read than my bad English ;) Well, bad luck. Your issue would have been a better fit for fop-user. Jeremias Maerki
Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
Hi Jeremias, The CDATA is only to maintain the XSL well-formed, since I close fo:flow on another template, the tech is good, maybe dev team implement a SAX over the stream from XML+XSL transformation option, this is the feature that I mean. Note that this is to reduce memory consuption. Best regards Clovis Jeremias Maerki wrote: On 09.01.2004 18:29:14 Clvis Wichoski wrote: snip/ xsl:template name="ctrlPage" xsl:if test="(position() mod 3) = 0" xsl:text disable-output-escaping="yes"![CDATA[/fo:flow/fo:page-sequencefo:page-sequence master-reference="A4" language="pt" country="br"]]/xsl:text xsl:call-template name="header"/ xsl:text disable-output-escaping="yes"![CDATA[fo:flow flow-name="xsl-region-body"]]/xsl:text /xsl:if /xsl:template The problem is that you put some XML code into a CDATA section. On-the-fly processing works with SAX. And in SAX your code will be delivered as text instead of as elements. snip/ I can't understand because on the fly don't woks and from .fo file generated from xml+xsl transformation work, maybe a bug of FOP, or I can't generate XML elements using CDATA from this form. The latter. I post this in dev list because I think that this is a feature or a bug on FOP then I attached the XSL and XML files that the team can test this issue, and the code is better to read than my bad English ;) Well, bad luck. Your issue would have been a better fit for fop-user. Jeremias Maerki
Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
Clóvis Wichoski wrote: The CDATA is only to maintain the XSL well-formed, since I close fo:flow on another template, Opening and closing XML tags within different XSL templates is bad practice. You'll need to redesign your XSL stylesheet or run the XSL Transform as a separate process, serialize the resulting FO and then present the FO to FOP. the tech is good, maybe dev team implement a SAX over the stream from XML+XSL transformation option, this is the feature that I mean. This isnt very clear, but if you mean serializing the result of the XSL transform before processing the FO then I wouldnt see this as a desirable feature for FOP. Mainly because it will slow down processing. If users require this functionality then they can implement it themselves very easily as I suggested above. Note that this is to reduce memory consuption. Chris
Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
Chris Bowditch wrote: Opening and closing XML tags within different XSL templates is bad practice. You'll need to redesign your XSL stylesheet or run the XSL Transform as a separate process, serialize the resulting FO and then present the FO to FOP. But with multiple pages like 500 pages the redesign must be in XML source, that need redesign in all XSL too (HTML, PDF, TXT and many others), this cause a rework that I attempted to avoid, and only needed because FOP throubles with memory, this is only a relief. Thanks for all reply Clovis
Re: multi page-sequence don't work for (XML+XSL) to PDF on the fly
This is just a guess, but perhaps you could do a pre-pass using XSL to generate multiple output pages, and then use something like iText[1] to concatenate your output files together. FOP Resources: http://xml.apache.org/fop/resources.html I hope this helps! Web Maestro Clay On Jan 9, 2004, at 10:45 AM, Clóvis Wichoski wrote: Chris Bowditch wrote: Opening and closing XML tags within different XSL templates is bad practice. You'll need to redesign your XSL stylesheet or run the XSL Transform as a separate process, serialize the resulting FO and then present the FO to FOP. But with multiple pages like 500 pages the redesign must be in XML source, that need redesign in all XSL too (HTML, PDF, TXT and many others), this cause a rework that I attempted to avoid, and only needed because FOP throubles with memory, this is only a relief. Thanks for all reply Clovis
RE: multi page-sequence don't work for (XML+XSL) to PDF on the fly
-Original Message- From: Clovis Wichoski [mailto:[EMAIL PROTECTED] snip / But with multiple pages like 500 pages the redesign must be in XML source, that need redesign in all XSL too (HTML, PDF, TXT and many others), this cause a rework that I attempted to avoid, and only needed because FOP throubles with memory, this is only a relief. Hi, Can't you use multiple page-sequences instead of just creating one sequence 'interrupted' by the 'ctrlPage' template? A few remarks to help you on your way: 1. I can't seem to find the reason why you are placing the whole fo:static-content into a separate template, since it is ... well, static and it doesn't rely on the elements in the XML (unless something is missing). 2. In the ctrlPage template, you are testing for a position(): you could also use XPath to select these, like xsl:apply-templates select=product[(position() mod 3) = 0] Then inside the product template, use xsl:for-each select=preceding::product[position() 3] / to grab the two preceding product nodes. 3. Check our http://xml.apache.org/fop/resources.html page, among the books and articles, there's a link to Dave Pawson's XSLT FAQ. Over there, you'll find a lot of useful stuff (amongst others on grouping which I think you'll find particularly helpful), so I'll bet you can work out a redesign which affects only the XSL itself and leaves the other files alone. If you really can't get any further, try posting your problem on Mulberry's XSLT list. Warning: it's a quite high-traffic list, but the upside is that the tips are 'highly-usable' ;) Hope this helps! Cheers, Andreas