gpt4 book ai didi

xml - 以下功能未由 Apache FOP 实现,但 : table-layout ="auto" (on fo:table)

转载 作者:数据小太阳 更新时间:2023-10-29 02:29:24 25 4
gpt4 key购买 nike

The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table)

我在控制台中收到以上警告。我正在尝试导出到文档。使用相同的 XML 和 XSLT,我可以导出到 PDF,但导出到 doc 会得到空白文档。

--------------- My XML -----------------------------

<?xml version="1.0" encoding="UTF-8"?>
<export>
<signPost>
<organisationName>Organisation NEW TEST1</organisationName>
<address1>Address Line 1</address1>
<address2>Address Line 2</address2>
<address3>Address Line 3</address3>
<postCode>N194eh</postCode>
<phNumber>07999999999</phNumber>
<email>newmeh@meh.com</email>
<url>www.NOTnewmeh.com</url>
<profile>tee</profile>
</signPost>
<signPost>
<organisationName>Test Meta Organization</organisationName>
<address1 />
<address2 />
<address3 />
<postCode>N194EH</postCode>
<phNumber />
<email />
<url />
<profile />
</signPost>
<signPost>
<organisationName>Test Org Meta</organisationName>
<address1>Address Line 1</address1>
<address2>Address Line 2</address2>
<address3>Address Line 3</address3>
<postCode>N194EH</postCode>
<phNumber>07999999999</phNumber>
<email>newmeh@meh.com</email>
<url>www.NOTnewmeh.com</url>
<profile>Profile</profile>
</signPost>
<signPost>
<organisationName>eeeeeewe</organisationName>
<address1>Address Line 1</address1>
<address2>tee</address2>
<address3>Address Line 3</address3>
<postCode>n124jj</postCode>
<phNumber>07777777777</phNumber>
<email>meh@meh.com</email>
<url>meh.com</url>
<profile>Profile</profile>
</signPost>
<signPost>
<organisationName>sdfsdfs</organisationName>
<address1>Address Line 1</address1>
<address2>Address Line 2</address2>
<address3>Address Line 3</address3>
<postCode>a332kk</postCode>
<phNumber>07999999999</phNumber>
<email>newmeh@meh.com</email>
<url>www.NOTnewmeh.com</url>
<profile>Profile</profile>
</signPost>
<signPost>
<organisationName>this</organisationName>
<address1>Address Line 1</address1>
<address2>Address Line 2</address2>
<address3>Address Line 3</address3>
<postCode>n377mm</postCode>
<phNumber>07999999999</phNumber>
<email>newmeh@meh.com</email>
<url>www.NOTnewmeh.com</url>
<profile>Profile</profile>
</signPost>
<signPost>
<organisationName>New Org</organisationName>
<address1>Address Line 1</address1>
<address2>Address Line 2</address2>
<address3>Address Line 3</address3>
<postCode>NW1 2SD</postCode>
<phNumber>07999999999</phNumber>
<email>newmeh@meh.com</email>
<url>www.NOTnewmeh.com</url>
<profile>Profile</profile>
</signPost>
</export>

---------------------------

----- MY XSLT -----------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="form"
page-height="29.7cm" page-width="21.0cm" margin-right="2cm"
margin-left="1cm" margin-top="1cm" margin-bottom="0cm">
<fo:region-body margin-top="1cm" margin-bottom="1cm" />
<fo:region-before region-name="header" extent="1cm" />
<fo:region-after region-name="footer" extent="1cm" />
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="form">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="export" />
</fo:flow>
</fo:page-sequence>

</fo:root>
</xsl:template>

<xsl:template match="export">
<fo:table >

<fo:table-body>
<xsl:for-each select="signPost">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<fo:table-row>
<fo:table-cell>
<fo:block padding-top="2mm">
<xsl:value-of select="organisationName" />
</fo:block>

</fo:table-cell>
</fo:table-row>
</xsl:when>
</xsl:choose>

</xsl:for-each>
</fo:table-body>
</fo:table>


</xsl:template>

</xsl:stylesheet>

最佳答案

尝试在您的 fo:table 中添加 table-layout="fixed",使其变为:

<fo:table table-layout="fixed">

您可能还需要添加表格的宽度

<fo:table table-layout="fixed" width="100%">

如果仍然收到警告,请尝试定义列的宽度:

...
<fo:table-column column-width="30%"/>
<fo:table-body>
...

但是,我怀疑您是否因为这个警告而得到一个空白文档。如果您执行以下操作,您会得到什么?

<xsl:template match="export">
<fo:block>test</fo:block>
</xsl:template>

关于xml - 以下功能未由 Apache FOP 实现,但 : table-layout ="auto" (on fo:table),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32646189/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com