Note that there are some explanatory texts on larger screens.

plurals
  1. POlink target could not be resolved
    text
    copied!<p>I am creating a table of contents and a bookmark tree using Saxon (9.1) and FOP (0.95). Everything works fine, except for the following FOP output:</p> <pre><code>WARNING: 1 link target could not be resolved and now point to the top of the page or is dysfunctional. </code></pre> <p>In the resulting PDF, all links (from both TOC and bookmark tree) point to the first chapter. Why is that? Thank you for any help.</p> <p><strong>XML input file:</strong></p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;document&gt; &lt;header&gt; &lt;title&gt;This is the title of the document&lt;/title&gt; &lt;author&gt;Mathias Mueller&lt;/author&gt; &lt;date&gt;29/10/2013&lt;/date&gt; &lt;/header&gt; &lt;body&gt; &lt;chapter level="1"&gt; &lt;chaptitle&gt;This is the title of the first chapter.&lt;/chaptitle&gt; &lt;p&gt;All Saints Day (also known as All Hallows, Solemnity of All Saints...&lt;/p&gt; &lt;/chapter&gt; &lt;chapter level="2"&gt; &lt;chaptitle&gt;This is the title of the second chapter.&lt;/chaptitle&gt; &lt;p&gt;In Western Christian theology, the day commemorates ...&lt;/p&gt; &lt;/chapter&gt; &lt;chapter level="2"&gt; &lt;chaptitle&gt;This is the title of the third chapter.&lt;/chaptitle&gt; &lt;p&gt;The feast of All Saints achieved great prominence in the ninth century, in the reign of the Byzantine Emperor, Leo VI the Wise...&lt;/p&gt; &lt;/chapter&gt; &lt;/body&gt; &lt;documentProperties&gt; &lt;orientation&gt;portrait&lt;/orientation&gt; &lt;format&gt;A4&lt;/format&gt; &lt;/documentProperties&gt; &lt;/document&gt; </code></pre> <p><strong>XSLT 2.0-Stylesheet</strong> (only attribute-sets defining block properties are left out) </p> <pre><code>&lt;xsl:template match="node()|@*"&gt; &lt;xsl:apply-templates select="node()|@*"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="document"&gt; &lt;xsl:element name="fo:root" xmlns="http://www.w3.org/1999/XSL/Format"&gt; &lt;xsl:call-template name="docPr"/&gt; &lt;xsl:call-template name="bmt"/&gt; &lt;!--page sequence for TOC--&gt; &lt;xsl:element name="fo:page-sequence"&gt; &lt;xsl:attribute name="master-reference"&gt;A4portrait&lt;/xsl:attribute&gt; &lt;xsl:element name="fo:flow"&gt; &lt;xsl:attribute name="flow-name"&gt;xsl-region-body&lt;/xsl:attribute&gt; &lt;xsl:call-template name="toc"/&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;!--rest--&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template name="docPr"&gt; &lt;xsl:element name="fo:layout-master-set"&gt; &lt;xsl:if test="documentProperties/orientation eq 'portrait' and documentProperties/format eq 'A4'"&gt; &lt;xsl:element name="fo:simple-page-master" use-attribute-sets="A4portrait"&gt; &lt;xsl:element name="fo:region-body"&gt; &lt;xsl:attribute name="margin-top"&gt;25mm&lt;/xsl:attribute&gt; &lt;xsl:attribute name="margin-bottom"&gt;20mm&lt;/xsl:attribute&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:if&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template name="bmt"&gt; &lt;xsl:element name="fo:bookmark-tree"&gt; &lt;xsl:for-each select="body/chapter"&gt; &lt;xsl:element name="fo:bookmark"&gt; &lt;xsl:attribute name="internal-destination"&gt;{generate-id()}&lt;/xsl:attribute&gt; &lt;xsl:element name="fo:bookmark-title"&gt; &lt;xsl:value-of select="chaptitle"/&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:for-each&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template name="toc"&gt; &lt;xsl:element name="fo:block"&gt; &lt;xsl:attribute name="break-before"&gt;page&lt;/xsl:attribute&gt; &lt;xsl:element name="fo:block" use-attribute-sets="title2-block"&gt; &lt;xsl:text&gt;Table of Contents&lt;/xsl:text&gt; &lt;/xsl:element&gt; &lt;xsl:for-each select="body/chapter"&gt; &lt;xsl:element name="fo:block"&gt; &lt;xsl:attribute name="text-align-last"&gt;justify&lt;/xsl:attribute&gt; &lt;xsl:element name="fo:basic-link"&gt; &lt;xsl:attribute name="internal-destination"&gt;{generate-id()}&lt;/xsl:attribute&gt; &lt;xsl:value-of select="count(preceding::chapter) + 1"/&gt; &lt;xsl:text&gt; &lt;/xsl:text&gt; &lt;xsl:value-of select="chaptitle"/&gt; &lt;xsl:element name="fo:leader"&gt; &lt;xsl:attribute name="leader-pattern"&gt;dots&lt;/xsl:attribute&gt; &lt;/xsl:element&gt; &lt;xsl:element name="fo:page-number-citation"&gt; &lt;xsl:attribute name="ref-id"&gt;{generate-id()}&lt;/xsl:attribute&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:for-each&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template match="chapter"&gt; &lt;xsl:element name="fo:page-sequence"&gt; &lt;xsl:attribute name="master-reference"&gt;A4portrait&lt;/xsl:attribute&gt; &lt;xsl:attribute name="id"&gt;{generate-id()}&lt;/xsl:attribute&gt; &lt;xsl:element name="fo:flow"&gt; &lt;xsl:attribute name="flow-name"&gt;xsl-region-body&lt;/xsl:attribute&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:element&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template match="chaptitle"&gt; &lt;xsl:element name="fo:block" use-attribute-sets="title1-block"&gt; &lt;xsl:value-of select="."/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template match="p"&gt; &lt;xsl:element name="fo:block" use-attribute-sets="normal-block"&gt; &lt;xsl:value-of select="."/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload