FOP 中的循环失败

发布于 2024-09-07 12:53:02 字数 2001 浏览 1 评论 0原文

我试图在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

予囚 2024-09-14 12:53:02

“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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文