如何从xsl文件中删除头文件而不在pdf下载时爆炸

2024-05-15 18:45:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我想删除这个估计标题和下面的黑线。我试过把

                <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)')

试图删除“估计”一词

甚至试着去掉黑条:

                <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')

Unable to generate PDF部分是自定义的

这个xsl-fo的东西真的很挑剔,有人知道为什么我不能删除其中一个而不炸掉它吗?谢谢

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

enter image description here


Tags: thenameorgnumberapachetableattributeblock
1条回答
网友
1楼 · 发布于 2024-05-15 18:45:05

如果每次都显示删除的内容,那么删除整个fo:block会给您留下一个没有内容的fo:table-cell。“marker*(%block;)+”告诉您fo:table-cell应该有一个或多个块级FOs(在零个或多个fo:marker之后)。你知道吗

第二个问题可能与删除属性无关。FOP可能是在检查完FOs的内容之后再检查表的布局。第一个示例中错误的位置与第二个示例中错误消息的位置非常不同。检查它告诉你的线路。你知道吗

如果您想在让FOP抱怨之前检查FO,https://github.com/AntennaHouse/focheck会找到空的表单元格,但它不会检查表布局。你知道吗

顺便说一句,你的三个xsl:attribute只需要一个border就可以完成。你知道吗

相关问题 更多 >