codyc4321
codyc4321

Reputation: 9682

how to remove header from xsl file without blowing up on pdf download

I want to remove this Estimated header and the black line underneath. I've tried removing

                <fo:block text-align="center" padding-left="4pt" margin-left="4pt" margin-bottom="4pt" padding-bottom="4pt">
                <xsl:attribute name="border-bottom-color">black</xsl:attribute>
                <xsl:attribute name="border-bottom-width">0.7pt</xsl:attribute>
                <xsl:attribute name="border-bottom-style">solid</xsl:attribute>

                    Estimated
                </fo:block>

('Unable to generate PDF.', 
b'Exception\norg.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: 
"fo:table-cell" is missing child elements. Required content model: marker* (%block;)+ (See position 8:104)
javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
 "fo:table-cell" is missing child elements. Required content model: marker* (%block;)+ (See position 48:104)')

tried removing just the word "Estimated",

and even tried just removing the black bar:

                <xsl:attribute name="border-bottom-color">black</xsl:attribute>
                <xsl:attribute name="border-bottom-width">0.7pt</xsl:attribute>
                <xsl:attribute name="border-bottom-style">solid</xsl:attribute>

('Unable to generate PDF.', b'Exception\norg.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: 
The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table. (See position 25:15)
javax.xml.transform.TransformerException: 
org.apache.fop.fo.ValidationException: The column-number or number of cells in the row overflows the number of fo:table-columns specified for the table. (See position 25:15)\n\n')

The Unable to generate PDF part is custom

This xsl-fo stuff is really picky, does anyone know why I can't remove even one of these pieces without it blowing up? Thank you

https://gist.github.com/codyc4321/d8b50adfb9fd1686355e

enter image description here

Upvotes: 1

Views: 225

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

If you're showing what you removed each time, removing the entire fo:block has left you with an fo:table-cell with no content. The "marker* (%block;)+" is telling you that fo:table-cell is expected to have one-or-more block-level FOs (following zero-or-more fo:marker).

Your second problem may be unrelated to removing the attributes. FOP is probably checking the table layout after it's checked the content of the FOs. The locations for the errors from your first example is very different from the location of the error message in your second example. Check the line that it's telling you about.

If you want to check your FO before letting FOP complain about it, https://github.com/AntennaHouse/focheck would find your empty table cell, but it doesn't go as far as checking the table layout.

BTW, your three xsl:attribute could be done with just a border.

Upvotes: 2

Related Questions