Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2813

Internal Links break when using page-number-citiation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: fo/block, fo/page
    • Labels:
      None
    • Environment:
      XALAN
      XSL 2.0

      Description

      Internal page links break when used in conjunction with pager-number-citiation.

      I made a minimal sheet which generates a ToC and 4 data sites. Links to data1-data3 do not work. Link to data4 works. The breaking point is in the footer with the call to "page-number-citiation-last" ("page-number-citiation" breaks it too). All links to pages AFTER the call (In this case its the id of data3) work. All before do not.

      This issue is not limited to using page-number-citiation in static content but also in page flow. As soon as an id is referenced via this call all internal links that point to the id or any id before in the document break.

      Stylesheet (Also attached with generated pdf):

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                      xmlns:fo="http://www.w3.org/1999/XSL/Format"
                      xmlns:java="http://xml.apache.org/xalan/java"
                      version="2.0">
      
        <xsl:output method="xml" indent="yes" encoding="utf-8"></xsl:output>
      
        <xsl:template match="/">
      
          <fo:root>
            <fo:layout-master-set>
              <fo:simple-page-master master-name="A4-portrait" page-height="29.7cm" page-width="21.0cm" margin="2cm">
                <fo:region-body margin-top="2.5cm" margin-bottom="0.1cm"/>
                <fo:region-before extent="2.5cm"/>
                <fo:region-after extent="0.1cm"/>
              </fo:simple-page-master>
            </fo:layout-master-set>
      
            <fo:page-sequence master-reference="A4-portrait" id="toc">
              <fo:flow flow-name="xsl-region-body">
                <fo:block>
                  <fo:basic-link internal-destination="data1">data1</fo:basic-link>
                </fo:block>
                <fo:block>
                  <fo:basic-link internal-destination="data2">data2</fo:basic-link>
                </fo:block>
                <fo:block>
                  <fo:basic-link internal-destination="data3">data3</fo:basic-link>
                </fo:block>
                <fo:block>
                  <fo:basic-link internal-destination="data4">data4</fo:basic-link>
                </fo:block>
              </fo:flow>
            </fo:page-sequence>
      
            <fo:page-sequence master-reference="A4-portrait" id="data1">
              <xsl:call-template name="footer"/>
              <xsl:call-template name="blob-template">
                <xsl:with-param name="blob">data 1</xsl:with-param>
              </xsl:call-template>
            </fo:page-sequence>
      
            <fo:page-sequence master-reference="A4-portrait" id="data2">
              <xsl:call-template name="footer"/>
              <xsl:call-template name="blob-template">
                <xsl:with-param name="blob">data 2</xsl:with-param>
              </xsl:call-template>
            </fo:page-sequence>
      
            <fo:page-sequence master-reference="A4-portrait" id="data3">
              <xsl:call-template name="footer"/>
              <xsl:call-template name="blob-template">
                <xsl:with-param name="blob">data 3</xsl:with-param>
              </xsl:call-template>
            </fo:page-sequence>
      
            <fo:page-sequence master-reference="A4-portrait" id="data4">
              <xsl:call-template name="footer"/>
              <xsl:call-template name="blob-template">
                <xsl:with-param name="blob">data 4</xsl:with-param>
              </xsl:call-template>
            </fo:page-sequence>
          </fo:root>
        </xsl:template>
      
        <xsl:template name="blob-template">
          <xsl:param name="blob"></xsl:param>
          <fo:flow flow-name="xsl-region-body">
            <fo:block>
              <xsl:value-of select="$blob"/>
            </fo:block>
          </fo:flow>
        </xsl:template>
      
        <!-- ################# FOOTER ################################### -->
        <xsl:template name="footer">
          <fo:static-content flow-name="xsl-region-after">
            <fo:block text-align="center">
              <fo:page-number/> /
              <fo:page-number-citation-last ref-id="data3"/>
            </fo:block>
          </fo:static-content>
        </xsl:template>
      
      </xsl:stylesheet>

      Output when generating:

      2018-09-05 14:03:33,829 - WARN  - The contents of fo:region-after on page 2 exceed the available area in the block-progression direction by 11566 millipoints. (No context info available)
      2018-09-05 14:03:33,835 - WARN  - The contents of fo:region-after on page 3 exceed the available area in the block-progression direction by 11566 millipoints. (No context info available)
      2018-09-05 14:03:33,837 - WARN  - The contents of fo:region-after on page 4 exceed the available area in the block-progression direction by 11566 millipoints. (No context info available)
      2018-09-05 14:03:33,840 - WARN  - The contents of fo:region-after on page 5 exceed the available area in the block-progression direction by 11566 millipoints. (No context info available)
      2018-09-05 14:03:33,844 - INFO  - Rendered page #1.
      2018-09-05 14:03:33,845 - INFO  - Rendered page #2.
      2018-09-05 14:03:33,846 - INFO  - Rendered page #3.
      2018-09-05 14:03:33,847 - INFO  - Rendered page #4.
      2018-09-05 14:03:33,847 - INFO  - Rendered page #5.
      2018-09-05 14:03:33,848 - WARN  - 4 link targets could not be fully resolved and now points to the top of the page or are dysfunctional.

        Attachments

        1. minimal_report.xsl
          3 kB
          Dennis
        2. out.pdf
          8 kB
          Dennis

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Dennis-R Dennis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: