2

I need for my xsl:fo transformation an <fo:retrieve-marker> in an table but I don't know if this is possible because I use FOP Processor for my transformation.

If i use the <fo:retrieve-marker> in my table I always get an error message that the tag has to be in an static content.

Here is the table with the marker

                <xsl:call-template name="MMEL-Table-Header"/>

                <!-- Bottom table Line  -->
                <fo:table-footer>
                    <fo:table-row>
                        <fo:table-cell>                                                                             
                            <fo:marker marker-class-name="footer-continued"> <fo:inline>(continued)</fo:inline></fo:marker>
                        </fo:table-cell>
                    </fo:table-row>

                </fo:table-footer>

                <fo:table-body >               

                    <xsl:variable name="identification">
                        <xsl:value-of select="ident/message"/>                                 
                    </xsl:variable>                       
                    <xsl:apply-templates select="ident"><xsl:with-param name="ident" select="$identification"/></xsl:apply-templates>
                    <xsl:apply-templates select="provisos/proviso"><xsl:with-param name="ident" select="$identification"/></xsl:apply-templates>

                <fo:table-row>
                    <fo:table-cell> <fo:retrieve-marker retrieve-position="first-starting-within-page" retrieve-class-name="footer-continued" retrieve-boundary="document" /> </fo:table-cell>
                </fo:table-row>
                </fo:table-body>           
            </fo:table>          
potame
  • 7,597
  • 4
  • 26
  • 33
bvb1909
  • 191
  • 2
  • 6
  • 19
  • Can you provide us snippet of code to see where you are using ``. But basically, a `retrieve-marker` can only be used in a page header or footer (``). – potame Jun 22 '15 at 09:14
  • okay if i put the marker in the page footer I get no Error Message but this is need the issue want to show my text in the table – bvb1909 Jun 22 '15 at 09:49
  • Of course it will appear in the footer... A workaround that I suggest could be to set negative top margins for the *(to be continued)* text so that it appears higher in the page. But unless you use a commercial product such as Antenna House or RenderX which support `retrieve-table-marker`, I'm afraid you have no choice. – potame Jun 22 '15 at 10:23
  • I checked my fop version i use 1.1 maybe the new fop version supports the table markeer – bvb1909 Jun 22 '15 at 13:29
  • 1
    In https://xmlgraphics.apache.org/fop/compliance.html, it is documented that should it be **partially** supported starting from FOP 2.0. – potame Jun 22 '15 at 13:49
  • As @potame said, FOP 2.0 partially supports table markers (I just tested it with a simple example); but _could you clarify a bit what you are trying to achieve_? Your code has the `fo:marker` inside the table footer, and the `fo:retrieve-marker` inside the table body, which seems strange ... – lfurini Jun 22 '15 at 17:02
  • 1
    I want to archive a text output if the table goes on the next site – bvb1909 Jun 23 '15 at 07:00

1 Answers1

5

(disclosure: I'm a FOP developer)

This example has dynamic table header and table footer, so it should cover your requirements:

  • if the table fits in a single page, both table header and table footer are empty
  • if the table is split over several pages
    • the table header is empty for the first page, and in the following ones it says "(continued)"
    • the table footer is empty for the last page, and in the previous ones it says "(continues on the next page)"
  • tested with FOP 2.0 (older versions did not support table markers); due to FOP's current limitations, the non-breaking space &#x00A0; in the table header and table footer is a necessary "placeholder" (the header / footer dimensions are computed just once, without marker content)
  • no formatter-specific extensions, so this could work with other formatters too (XslFormatter supports table markers; XEP has alternative workarounds)

FO fragment:

  <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="100%"/>
    <fo:table-header>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:retrieve-table-marker retrieve-class-name="mc1" 
                retrieve-position-within-table="first-starting" 
                retrieve-boundary-within-table="table-fragment"/>
            &#x00A0;
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-header>
    <fo:table-footer>
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:retrieve-table-marker retrieve-class-name="mc2" 
                retrieve-position-within-table="last-ending" 
                retrieve-boundary-within-table="table-fragment"/>
            &#x00A0;
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-footer>
    <fo:table-body>
      <!-- first row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1"></fo:marker>
            <fo:marker marker-class-name="mc2">(continues on the next page)</fo:marker>
            cell1
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
      <!-- middle row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1">(continued)</fo:marker>
            <fo:marker marker-class-name="mc2">(continues on the next page)</fo:marker>
            cell2
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
      <!-- ... other similar rows ... -->
      <!-- last row -->
      <fo:table-row>
        <fo:table-cell>
          <fo:block>
            <fo:marker marker-class-name="mc1">(continued)</fo:marker>
            <fo:marker marker-class-name="mc2"></fo:marker>
            cell9
          </fo:block>
        </fo:table-cell>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
lfurini
  • 3,729
  • 4
  • 30
  • 48
  • 1
    Great example. Note that it will not work with RenderX XEP. We have chosen not to support retrieve-table-marker as of this time. We may in the future but have been able to workaround better (and much faster) solutions in most all implementations for folks. – Kevin Brown Jun 23 '15 at 23:52
  • I have noticed this feature in FOP : https://xmlgraphics.apache.org/fop/2.0/extensions.html#table-continue-label. Is it available in FOP 1.1 or not? – potame Jun 30 '15 at 08:19
  • @potame No, the `fox:continued-label` extension dated back to the older versions and is not available in FOP 1.1 and 2.0: [source, see last bullet point](https://xmlgraphics.apache.org/fop/2.0/upgrading.html#pre-1.0) _(to be honest I'm getting an error even with FOP 0.20.5, but maybe I'm just using it in the wrong position)_ – lfurini Jun 30 '15 at 15:26