xsl-fo - 如何使用引线垂直对齐 2 个块
问题描述
我需要使用 fo:leader 创建一个包含请求和响应的表,如下所示:
然而最终的结果是这样的:
我的问题是当左块有 2 行而右块有 2 行时,它们都在顶部对齐。我需要对齐顶部的左块和底部的右块。
那可能吗?
按照实际代码:
<fo:inline-container vertical-align="top" inline-progression-dimension="60%">
<fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify" margin-right="0.3cm"<xsl:value-of select="challenge/para|limitdesc/para|sopitem/para"/>
<fo:leader leader-pattern="dots"/</fo:block>
</fo:inline-container>
<fo:inline-container relative-position="relative" vertical-align="bottom" display-align="after" inline-progression-dimension="40%">
<fo:block start-indent="0.5em" text-indent="-0.5em" display-align="after"><xsl:value-of select="response/para|limitvalue/para|limittext/para|act/para"/></fo:block>
</fo:inline-container>
解决方案
扩展@tmakita 的答案,您可以使用alignment-baseline
来对齐两者的基线(参见https://www.w3.org/TR/xsl11/#fo_inline-containerfo:inline-container
的讨论)。
您可以使用last-line-end-indent
(参见https://www.w3.org/TR/xsl11/#last-line-end-indent)让领导项目超过文本末尾,但您还需要限制文本。在这个例子中,我在第一个fo:block-container
里面使用了一个fo:inline-container
:
<fo:block>
<fo:inline-container vertical-align="top" inline-progression-dimension="60%" alignment-baseline="text-after-edge">
<fo:block-container width="50%">
<fo:block start-indent="0.5em" text-indent="-0.5em" text-align-last="justify" last-line-end-indent="-100%">
[3] Text here text here text here text here text here text here text here text here text here text here text here text here text here Text here text here text here text here text here text here text here<fo:leader leader-pattern="dots" leader-length.minimum="50%" leader-length.optimum="50%"/></fo:block>
</fo:block-container>
</fo:inline-container><fo:inline-container inline-progression-dimension="40%">
<fo:block start-indent="0.5em" text-indent="-0.5em">
Continued text here text here text here text here
</fo:block>
</fo:inline-container>
</fo:block>
除非您希望最后一行上的文本能够超出其余部分,否则最小和最佳前导长度应该至少是两组文本之间间隙的宽度。
推荐阅读
- docker - docker 容器中的 dotnet 进程故障排除
- c# - IdentityDbContext 如何配置迁移
- github - 如何跟踪 master 但可以选择推送到本地分支或 master 分支?
- java - 抛出 SQLException 但一切正常
- java - 如何通过 JavaBean 转换数字并将其发送回 JSP 页面
- authentication - 如何找出哪些值对 Symfony 4 中 Argon2i 的 memory_cost、threads 和 time_cost 有利?
- javascript - node.js 编译的 pkg 不会运行(但从节点运行)
- cakephp - 获取 CakePHP 3.6 中所有关联模型的列表
- azure-ad-b2c - Azure B2C 用户迁移令人困惑的演示代码
- c# - 转换为 Linq(lambda 表达式) - 仅选择一个带有连接的表