生成 PDF 期间块容器的 XSL-FO 错误

XSL-FO error with block-container during generation PDF

我在尝试使用文件 XSL-FO 生成 PDF 时遇到问题。 我的 XSL:

`

fo:block-container position="absolute" absolute-position="absolute" top="49mm" left="24mm" width="165mm" height="30mm" >
<fo:block>
      <fo:table>
                <fo:table-column column-width="79mm"/>
                <fo:table-column column-width="80mm"/>`

                <fo:table-body>
                    <fo:table-row height="10mm">
                        <fo:table-cell xsl:use-attribute-sets="box" number-rows-spanned="2">                            
                            <fo:block>

                <xsl:attribute name="font-weight">bold</xsl:attribute>
                <xsl:attribute name="text-align">center</xsl:attribute>
                <xsl:value-of select="NewDataSet/Interface/dossier_num"/> <xsl:value-of select="NewDataSet/Dossier/no_dossier"/>
              </fo:block>
                            <fo:block>
                                <fo:table>
                                    <fo:table-column />                                 
                                    <fo:table-body>
                    <fo:table-row>
                                            <fo:table-cell>
                                                <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/code_produit"/><xsl:text>: </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/code_produit"/>
                                                </fo:block>
                                            </fo:table-cell>
                    </fo:table-row>
                                        <fo:table-row>
                                            <fo:table-cell>
                                                <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/modele"/><xsl:text>: </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/modele"/>
                                                </fo:block>
                                            </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                                            <fo:table-cell>
                                                <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/provenance"/><xsl:text>: </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/mag_depot"/>
                                                </fo:block>                                             
                                            </fo:table-cell>
                                        </fo:table-row>
                                        <fo:table-row>
                                            <fo:table-cell>
                        <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/numero_serie"/><xsl:text>: </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/serie"/>
                                                </fo:block>
                                            </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                                            <fo:table-cell>
                        <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/garantie"/><xsl:text>: </xsl:text>                         
                          <xsl:choose>
                            <xsl:when test="/NewDataSet/Table/sous_garantie='true'"><xsl:value-of select="NewDataSet/Interface/oui"/></xsl:when>
                            <xsl:otherwise><xsl:value-of select="NewDataSet/Interface/non"/></xsl:otherwise>
                          </xsl:choose>                                             
                                                </fo:block>                                             
                                            </fo:table-cell>
                                        </fo:table-row>
                                        <fo:table-row>
                                            <fo:table-cell>
                        <fo:block font-size="8pt">
                                                    <xsl:attribute name="text-align">left</xsl:attribute>
                                                    <xsl:value-of select="NewDataSet/Interface/marque"/><xsl:text>: </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/marque"/>
                                                </fo:block>
                                            </fo:table-cell>                                            
                                        </fo:table-row>
                                        <fo:table-row>                                          
                                            <fo:table-cell>
                                                <fo:block font-weight="bold" text-align="right">
                                                    <xsl:value-of select="NewDataSet/Table/nom"/><xsl:text> </xsl:text>
                                                    <xsl:value-of select="NewDataSet/Table/prenom"/>
                                                </fo:block>                                             
                                            </fo:table-cell>
                                        </fo:table-row>
                                    </fo:table-body>
                                </fo:table>
                            </fo:block>
                        </fo:table-cell>        
            <fo:table-cell>
              <fo:table>
                <fo:table-column column-width="40mm"/>
                <fo:table-column column-width="40mm"/>

                <fo:table-body>
                  <fo:table-row height="14mm">
                    <fo:table-cell display-align="center">
                      <fo:block  font-weight="bold" text-align="center">

                        <xsl:value-of select="NewDataSet/Dossier/no_dossier"/>

                      </fo:block>
                      <fo:block  font-weight="bold" text-align="center">
                        <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of>
                      </fo:block>
                    </fo:table-cell>
                    <fo:table-cell display-align="center">
                      <fo:block  font-weight="bold" text-align="center">
                        <xsl:value-of select="NewDataSet/Dossier/no_dossier"/>

                      </fo:block>
                      <fo:block  font-weight="bold" text-align="center">
                        <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of>
                      </fo:block>
                    </fo:table-cell>
                  </fo:table-row >
                  <fo:table-row height="14mm">                                  
                  <fo:table-cell display-align="center">
                    <fo:block  font-weight="bold" text-align="center">
                      <xsl:value-of select="NewDataSet/Dossier/no_dossier"/>

                    </fo:block>
                    <fo:block  font-weight="bold" text-align="center">
                      <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of>
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell display-align="center">
                    <fo:block  font-weight="bold" text-align="center">
                      <xsl:value-of select="NewDataSet/Dossier/no_dossier"/>
                    </fo:block>
                    <fo:block  font-weight="bold" text-align="center">
                      <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of>
                    </fo:block>
                  </fo:table-cell>
              </fo:table-row>
              </fo:table-body>
            </fo:table>
            </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>  
`</fo:block>
</fo:block-container>

`

我有这个错误: 不可能在类型 'org.apache.fop.layout.AreaContainer

上转换类型为 'org.apache.fop.layout.BlockArea' 的对象

当我尝试在另一个使用相同 dll (apachefop.net) 的项目中生成时,我没有出现错误。 我怎样才能更换这个节点?我该如何解决这个问题?

谢谢

您有 fo:table 作为 child 到 fo:table 的单元格。将 table 包裹在一个块中。