Direct transformation (xml -> xsl -> fo -> pdf) produce different result than indirect (xml -> xsl -> fo) + (fo -> pdf) Example: xml: <labels> <empty no="2"/> <label3> <line>text</line> <line>2text</line> <line>3text</line> </label3> <label4> <line>4text</line> <line>42text</line> <line>43text</line> <line>44text</line> </label4> <label3> <line>text</line> <line>2text</line> <line>3text</line> </label3> <label4> <line>4text</line> <line>42text</line> <line>43text</line> <line>44text</line> </label4> <label3> <line>text</line> <line>2text</line> <line>3text</line> </label3> <label4> <line>4text</line> <line>42text</line> <line>43text</line> <line>44text</line> </label4> <empty no="2"/> <label3> <line>text</line> <line>2text</line> <line>3text</line> </label3> <label4> <line>4text</line> <line>42text</line> <line>43text</line> <line>44text</line> </label4> <label3> <line>text</line> <line>2text</line> <line>3text</line> </label3> <label4> <line>4text</line> <line>42text</line> <line>43text</line> <line>44text</line> </label4> </labels> xslt: <?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"/> <xsl:template match="labels"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master margin-right="1in div 4" margin-left="1in div 4" margin-bottom="1in div 4" margin-top="1in div 4" master-name="first"> <fo:region-body column-count="3" column-gap="1in div 16"/> <fo:region-after extent="1.5cm"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="first"> <fo:flow flow-name="xsl-region-body" column-count="3"> <xsl:apply-templates/> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template> <xsl:template match="empty"> <xsl:call-template name="empty-one"> <xsl:with-param name="to" select="@no"/> </xsl:call-template> </xsl:template> <xsl:template match="label4"> <fo:block> <fo:table border-collapse="separate" table-layout="fixed" border-top-width="1in div 8" height="21in div 20" width="2.4in" > <fo:table-column column-width="2.4in"/> <fo:table-body font-size="14pt"> <xsl:apply-templates /> </fo:table-body> </fo:table> </fo:block> </xsl:template> <xsl:template match="label3"> <fo:block> <fo:table border-collapse="separate" table-layout="fixed" border-top-width="1in div 8" height="21in div 20" > <fo:table-column column-width="2.4in"/> <fo:table-body font-size="16pt"> <xsl:apply-templates select="line" /> </fo:table-body> </fo:table> </fo:block> </xsl:template> <xsl:template match="label3/line"> <fo:table-row height="21in div 60" > <xsl:choose> <xsl:when test="position() = 1"> <fo:table-cell border-top-width="3pt" border-top-style="solid" border-top-color="white"> <fo:block-container height="1in div 3" width="2.37in" overflow="hidden"> <fo:block> <xsl:value-of select="text()" /> </fo:block> </fo:block-container> </fo:table-cell> </xsl:when> <xsl:otherwise> <fo:table-cell> <fo:block-container height="1in div 3" width="2.37in" overflow="hidden"> <fo:block> <xsl:value-of select="text()" /> </fo:block> </fo:block-container> </fo:table-cell> </xsl:otherwise> </xsl:choose> </fo:table-row> </xsl:template> <xsl:template match="label4/line"> <fo:table-row height="21in div 80" > <xsl:choose> <xsl:when test="position() = 1"> <fo:table-cell border-top-width="3pt" border-top-style="solid" border-top-color="white"> <fo:block-container height="1in div 4" width="2.37in" overflow="hidden"> <fo:block> <xsl:value-of select="text()"/> </fo:block> </fo:block-container> </fo:table-cell> </xsl:when> <xsl:otherwise> <fo:table-cell> <fo:block-container height="1in div 4" width="2.37in" overflow="hidden"> <fo:block> <xsl:value-of select="text()"/> </fo:block> </fo:block-container> </fo:table-cell> </xsl:otherwise> </xsl:choose> </fo:table-row> </xsl:template> <xsl:template name="empty-one"> <xsl:param name="to"/> <xsl:if test="$to > 1"> <xsl:call-template name="empty-one"> <xsl:with-param name="to" select="$to - 1"/> </xsl:call-template> </xsl:if> <fo:block> <fo:table border-collapse="separate" table-layout="fixed" border-top-width="1in div 8" height="21in div 20" width="2.4in"/> </fo:block> </xsl:template> </xsl:stylesheet>
I remember effects like this from my time when I worked with FOP 0.20.5, although I didn't experience such drastic differences. In my example that was almost always due to some whitespace. Without wasting a lot of time debugging in a branch that is not maintained anymore I can't tell you what's wrong. One part could be the XSL-FO that you generate. In the "empty-one" template you create empty fo:table elements which is illegal. Maybe FOP 0.20.5 doesn't like that. I'd recommend you upgrade to the latest release (0.91beta). You will have to clean up your stylesheet to make it work with that version (especially that empty fo:table, use a block-container instead, place an empty fo:block in the block-container). With FOP 0.91beta, I don't see any visual differences between the direct approach and the way over a temporary FO file. Good luck and sorry for the delay.
Dear Jeremias, Thank you for all afford that you have done. My problem resolution was not to use direct transformation. It is little annoying but simplest. Template "empty-one" is not a problem because when I change the source XML in a way that I have avoid "empty" nodes problem persist. Next things that I have tried is to delete all unnecessary white spaces, and when nothing has been changed, I was every open and close node convert to open node and close node (<node/> -> <node></node>). After that I give up, so it is something serious and I have conclude that problem does not depend on format of input xml or xslt. As I understand 0.20.5 is stable production version, and I need fop for production version of software, so my question is: "Is it risky to put 0.91 in production", and when can we expected that 0.91 will start to be stable (production) version of FOP (april, may, jun)? It's look like that delay is unavoidable. Thanks again.
(In reply to comment #2) > As I understand 0.20.5 is stable production version, and I need fop for > production version of software, so my question is: "Is it risky to put 0.91 in > production", and when can we expected that 0.91 will start to be stable > (production) version of FOP (april, may, jun)? From my point of view, it's ok to use FOP 0.91beta in production if everything is very carefully tested. It's still a beta because this release may not yet work for every kind of document. See also: http://xmlgraphics.apache.org/fop/relnotes.html#FOP+0.91+beta It's expected that the next release will still be a beta-level release as there are important areas that are currently worked on. It's difficult to predict a release date for a full release. It depends a lot on the amount of time the core developers can allocate, what they allocate their time on and how much help we get from the community. But it's probably reasonable to expect a production grade pre-1.0 release around May/June. No guarantees though. An open source project lives on the attention it gets by its community.
batch transition to closed remaining pre-FOP1.0 resolved bugs