FOP 中的循环失败
我试图在 FOP 中的表中添加一些额外的行,用以下代码填充它们最多 13 行:
<!-- Fill Up Empty space -->
<c:forEach var="i" begin="${position_id}" end="13" step="1">
<fo:table-row height="4.4mm" border-bottom-color="black"
border-bottom-style="fixed" border-bottom-width="0.2mm">
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block font-size="8pt" text-align="center">
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
</fo:table-row>
</c:forEach>
问题是我不断收到异常:
org.apache.fop.fo.ValidationException: file:/tmp/fop_1613051806105460695.fo:289:126: Error(289/126): fo:table-row is not a valid child element of forEach.
at org.apache.fop.fo.FONode.invalidChildError(FONode.java:435)
at org.apache.fop.fo.FONode.invalidChildError(FONode.java:420)
at org.apache.fop.fo.XMLObj.validateChildNode(XMLObj.java:70)
...
并且谷歌搜索也没有帮助。有什么想法吗?
I'm trying to add some additional lines to a table in FOP, to fill them up to 13 rows with this code:
<!-- Fill Up Empty space -->
<c:forEach var="i" begin="${position_id}" end="13" step="1">
<fo:table-row height="4.4mm" border-bottom-color="black"
border-bottom-style="fixed" border-bottom-width="0.2mm">
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block font-size="8pt" text-align="center">
</fo:block>
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
<fo:table-cell border-bottom-style="solid"
border-bottom-width="0.2mm" border-top-style="solid"
border-top-width="0.1mm">
<fo:block />
</fo:table-cell>
</fo:table-row>
</c:forEach>
Problem is that I keep getting an exception:
org.apache.fop.fo.ValidationException: file:/tmp/fop_1613051806105460695.fo:289:126: Error(289/126): fo:table-row is not a valid child element of forEach.
at org.apache.fop.fo.FONode.invalidChildError(FONode.java:435)
at org.apache.fop.fo.FONode.invalidChildError(FONode.java:420)
at org.apache.fop.fo.XMLObj.validateChildNode(XMLObj.java:70)
...
And Googling isn't helping either. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“c:forEach”不是 FOP 可以处理的。这是某种专有的 XML 转换语言吗?无论如何,您必须确保转换在 FOP 之前运行,并且 FOP 仅接收纯 XSL-FO。那么这个错误就会消失。
请注意 FO 部分:如果没有内容,该表行可能会折叠到零高度。您可能需要在表行上使用类似 block-progression-dimension.minimum="1.2em" 的内容来避免这种折叠效果。
"c:forEach" is nothing FOP can deal with. Is that some proprietary XML transformation language? At any rate, you'll have to make sure that transformation runs before FOP and FOP only receives plain XSL-FO. Then this error should go away.
Just a note on the FO parts: That table-row may collapse to zero height if there's no content. You may need to use something like block-progression-dimension.minimum="1.2em" on the table-row to avoid that collapsing effect.