Search code examples
xsltxsl-foapache-fop

xsl fo internal link does mot work across different page sequences


I got multiple page sequences which is necessary cause the data displayed has different parameters (some landscapes and some portrait). I struggle to build a ToC with links:

<fo:page-sequence id="toc">
<fo:page-sequence id="data1">
<fo:page-sequence id="data2">

<xsl:template name="toc">
  <fo:flow>
   <fo:block>
        <fo:basic-link internal-destination="data1">
          data 1
          <fo:leader leader-pattern="dots"/>
          <fo:page-number-citation ref-id="data1"/>
        </fo:basic-link>
      </fo:block>
   </fo:flow>
</xsl:template>

I get the following warning:

1 link target could not be fully resolved and now point to the top of the page or is dysfunctional

So the internal-destination cannot resolve the ID it always links to the start of the document but I want it to link to the top of the first page of the data1 page sequence.

If I put an ID that is nowhere in the document for internal-destination the link is fully broken and I get an error as expected. The page number shown for the data1 sequence is correct. Is it not possible to just link to a certain page? This would circumvent the problem.

I have to use XSL 2.0 and Xalan.

Update: Now the problem gets really weird. I got a footer in a "region-after" like this:

<fo:static-content flow-name="xsl-region-after">
  <fo:block>
    <fo:inline>
      <fo:page-number/>
      /
      <fo:page-number-citation-last ref-id="data5"/>
    </fo:inline>
  </fo:block>
</fo:static-content>

data5 beeing the last page sequence. If I put in data4 the link to data5 works but not to the others. If I take it out completely all links work! So this <fo:page-number-citation-last ref-id="data5"/> to get the last page number to put it into the footer is actually the problem. Why is that? How else do I get the last page number?

Calling page-number-citation-last thing in the footer seems to block the links!


Solution

  • You could try using the ID of the element that generates the first area inside the fo:page-sequence. If that doesn't have an ID, then give it one using generate-id() (see https://www.w3.org/TR/xslt20/#function-generate-id).