如何在 XSL FO 中插入水平拆分内联元素?

How is it possible to insert a horizontal split inline element in XSL FO?

我想知道是否以及如何将水平拆分 (50:50) 多行内联元素插入当前行 (fo:block)。

这张图应该能说明我的意思:

<fo:block>100mm<fo:inline>+4mm</fo:inline><fo:inline>-4mm</fo:inline>text...</fo:block>

如您所见,内联数据“100mm 会正常进行,然后特定数据”+4mm”和”-4mm”会以行高 50% 进行并叠加在另一个上。之后的其余部分将添加内容。

这可能吗? 我使用 AntennaHouse Formatter 进行渲染。

MathML 是你的朋友:

    <fo:block>This is my data: <fo:instream-foreign-object>
            <math xmlns="http://www.w3.org/1998/Math/MathML">
                <msubsup>
                    <mi>100mm</mi>
                    <mi>+4mm</mi>
                    <mi>-4mm</mi>
                </msubsup>
            </math>
        </fo:instream-foreign-object> and here it goes on...</fo:block>

参见,例如,https://www.data2type.de/en/xml-xslt-xslfo/math-ml/presentation-markup/scripts-and-limits/subscripts-superscripts/

如果您要包含很多 MathML,您可以将 MathML 的命名空间声明放在 XSLT 的 xsl:stylesheet 元素上,这样命名空间将在整个样式表的范围内,并且最终也会出现在结果的 fo:root 上。

Martin Honnen 描述的基本解决方案也有效:

<fo:block start-indent="0">
    This is my data: 100mm
    <fo:inline-container baseline-shift="4.25pt">
        <fo:block text-align="right" font-size="4.25pt">+5mm</fo:block>
        <fo:block text-align="right" font-size="4.25pt">-5mm</fo:block>
    </fo:inline-container> and here it goes on...
</fo:block>

这给出了所需的输出。

感谢您的帮助。