使用 XSL 在 JAVA 中生成 PDF 时遇到问题。总是得到“类 org.apache.fop.fo.flow.TableAndCaption 没有 LayoutManager 制造商”。这是 XSL 源代码:
<?xml version="1.0" encoding="Windows-1251"?>
<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="2.0" media-type="application/xslfo+xml" indent="yes" encoding="Windows-1251"/>
<xsl:template match="RootPart">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="allPages" page-height="297mm" page-width="210mm" margin-top="5mm" margin-bottom="5mm" margin-left="20mm" margin-right="5mm">
<fo:region-body margin-top="5mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence font-family="arial" font-size="9pt" font-weight="normal" master-reference="allPages">
<fo:flow flow-name="xsl-region-body">
<fo:table-and-caption table-layout="fixed" >
<fo:table border-style="solid" border-width="0.3mm" border-color="black">
<fo:table-column column-width="97mm"/>
<fo:table-column column-width="97mm"/>
<fo:table-header>
<fo:table-cell>
<fo:block>TEST1</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>TEST2</fo:block>
</fo:table-cell>
</fo:table-header>
<fo:table-body>
<fo:table-row height = "5mm">
<fo:table-cell>
<fo:block>Volvo</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$50000</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>SAAB</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>$48000</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-and-caption>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>