garlicDoge
garlicDoge

Reputation: 197

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

I´d like to know if and how it is possible to insert a horizontal splitted (50:50) multi-line inline element into the current line (fo:block).

This picture should describe what I mean: enter image description here

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

As you can see the inline data "100mm would be progressed normally and then specific data "+4mm" and "-4mm" are progressed with line-height 50% and layered over another. After that the rest of the content would be added.

Is this even possible? I use the AntennaHouse Formatter for rendering.

Upvotes: 1

Views: 466

Answers (2)

garlicDoge
garlicDoge

Reputation: 197

A basic solution like Martin Honnen described does also work:

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

This gives the desired output. enter image description here

Thanks for your help.

Upvotes: 0

Tony Graham
Tony Graham

Reputation: 8068

MathML is your friend:

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

MathML rendered in AH Formatter GUI.

See, e.g., https://www.data2type.de/en/xml-xslt-xslfo/math-ml/presentation-markup/scripts-and-limits/subscripts-superscripts/

If you're going to be including a lot of MathML, you can put the namespace declaration for MathML on the xsl:stylesheet element of your XSLT so the namespace will be in scope for the whole stylesheet and will also end up on the fo:root of your result.

Upvotes: 2

Related Questions