XSL-FO Table of Contents 页码在页面标题太长时左对齐

XSL-FO Table of Contents page number left aligned when page title is too long

我们正在使用此 XSL-FO 在目录页面的 Table 中生成条目:

<fo:block text-align-last="justify">
    <xsl:value-of select="@title" />
    <fo:leader leader-pattern="dots" />
    <fo:page-number-citation ref-id="{@id}" />
</fo:block>

当页面的标题很长时,页码会换行。如果页面标题足够长以将页码撞到一个新行 但不是 足够长以进入一个新行本身,则页码将在应该正确的时候左对齐对齐。

据我所知,XML 是正确的,这是 XSL-FO 本身的问题。有没有办法让所有页码右对齐而不重新设计任何其他布局?

更新:

感谢托尼·格雷厄姆 (Tony Graham) 的回复,不幸的是,出于某种原因,它似乎不适合我。在应该有一个连续领导者的线上,我最终会得到两组领导者点,这些点被一个我无法摆脱的小间隙隔开。但它确实激发了这个对我来说效果很好的解决方案:

<fo:block text-align-last="justify">
    <xsl:value-of select="@title" />
    <fo:leader leader-pattern="dots" />
    <fo:page-number-citation keep-with-previous="always" ref-id="{@id}" />
</fo:block>

https://www.antenna.co.jp/AHF/help/v70e/ahf-ext.html#axf.leader-expansion

上的 axf:leader-expansion 文档中基本上有示例 1、3 和 5

正如其他人指出的那样,您无法使用普通 XSL-FO 处理所有可能的 ToC 或索引变体,但您可以为您展示的示例获得结果:

<fo:flow flow-name="xsl-region-body"
     leader-alignment="reference-area"
     text-align-last="justify">
  <fo:block>Page with very short title<fo:leader leader-pattern="dots" keep-with-previous.within-line="always" /><fo:leader leader-pattern="dots" />3</fo:block>
  <fo:block>Page with very very very very very very very very long title<fo:leader leader-pattern="dots" keep-with-previous.within-line="always" /><fo:leader leader-pattern="dots" />4</fo:block>
  <fo:block>Page with very very very very very very very very very very very very long title<fo:leader leader-pattern="dots" keep-with-previous.within-line="always" /><fo:leader leader-pattern="dots" />5</fo:block>
</fo:flow>

使用 AH Formatter V7.0 测试。