【问题标题】:how to remove header from xsl file without blowing up on pdf download如何在不破坏pdf下载的情况下从xsl文件中删除标题
【发布时间】:2016-01-28 17:15:44
【问题描述】:

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

                <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

【问题讨论】:

    标签: python xml pdf xslt xsl-fo


    【解决方案1】:

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

    您的第二个问题可能与删除属性无关。 FOP 可能会在检查 FO 的内容后检查表格布局。第一个示例中的错误位置与第二个示例中错误消息的位置非常不同。检查它告诉你的那一行。

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

    顺便说一句,你的三个xsl:attribute 可以只用一个border

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-20
      • 2013-08-21
      • 2012-10-27
      • 1970-01-01
      • 2014-07-29
      • 2015-04-12
      相关资源
      最近更新 更多