2

I have a medieval manuscript encoded in XML (using TEI schema). The manuscript has a 'body' which has been mapped in XSL:FO to xsl-region-body and outputs perfectly. The manuscript also features some 'glosses' (notes) in the left and right margins. These are marked up within the XML document using, for example <add type="margin_gloss" place="left">Some foo note</add>

I have reserved xsl-region-startand xsl-region-end to receive these margin glosses relative to their position in the original manuscript. However I am having trouble getting the marked up text to 'flow' into these regions.

Note: I have no problem putting hardcoded data into these regions with, for example, <fo:static-content flow-name="xsl-region-after">

The problem is that with the below code Apache FOP is telling me : For "fo:page-sequence", only one "fo:flow" may be declared.

        <fo:page-sequence master-reference="odd">
            <fo:static-content flow-name="xsl-region-after"
                font-family="Times"
                font-size="8pt">
                <fo:block text-align="center">-<fo:page-number/>-
                </fo:block>
            </fo:static-content>
            <fo:flow flow-name="xsl-region-end"
                font-family="Times"
                font-size="6pt">
                <xsl:call-template name="marginalia-right"/>
            </fo:flow>
            <fo:flow flow-name="xsl-region-body" 
                font-family="Times"
                font-size="8pt"
                space-before="8pt"
                space-after="8pt">
                <xsl:apply-templates/>
            </fo:flow>
        </fo:page-sequence>

I extract the notes with an XSL template:

 <xsl:template match="//tei:add[@type='margin_gloss' and @place='right']" name="marginalia-right">
      <fo:block>
          <xsl:value-of select="text()"/>
      </fo:block>
  </xsl:template>

To summarize the problem: I would like the margin glosses marked up in XML with <add> to appear in xsl-region-start and xsl-region-end positioned relative to line of text in xsl-region-body. FPO tells me I can't 'flow' twice.

jbrehr
  • 775
  • 6
  • 19
  • Perhaps I need to use an alternate structure, like `xsl-fo tables` with 3 columns? The main content (the body) breaks naturally into paragraphs which visually would work within table 'cells'. That is to say...I'm open to rethinking the approach in `xsl-fo`. – jbrehr Dec 20 '17 at 22:45
  • Why is float-left and float-right not working? Like marginalia ... see this example http://www.renderx.com/usecasestest.html and Marginalia – Kevin Brown Dec 21 '17 at 03:14

1 Answers1

2

You can't synchronize content in region-start with content in region-body.

You can, however, place content in region-body and manipulate its position so it overlaps the region-start. XSL-FO provides the fo:float mechanism to do this.

<fo:block --extra wide and a negative left margin to overlap the region-start>
    <fo:float> this contains the margin note</fo:float>
    <fo:block>this contains the body text linked to the note</fo:block>
</fo:block>

FOP has limited support for fo:float. Commercial FO processors (I use Antennahouse Formatter) offer full support.

Hobbes
  • 1,964
  • 3
  • 18
  • 35
  • @kevin-brown thanks both. I'm trying to work out fo:float now. I may need to make a new post about this. In principle I should use a template like this to insert the float? ` ` – jbrehr Dec 21 '17 at 15:32
  • Yes, something like that. – Hobbes Dec 21 '17 at 15:59
  • I've worked on this for some time with no success, posted a new question here: https://stackoverflow.com/questions/47934126/xslfo-float-for-displaying-margin-notes-breaks-document – jbrehr Dec 21 '17 at 23:47