FOP XSL-FO Anchor in an external destination

后端 未结 1 1962
暖寄归人
暖寄归人 2021-02-20 14:54

With XSL-FO (Fop), I succeeded in creating a link to an external PDF :




        
相关标签:
1条回答
  • 2021-02-20 15:51

    For FOP we have two of link: Internal and External.

    For External you may use:

       <fo:basic-link 
        external-destination="url('http://www.paulmccartney.com')" 
        color="blue" text-decoration="underline">
         Paul McCartney
       </fo:basic-link>
    

    and Internal links are links from one location in a document to another location in the same document. There are two steps to creating internal links:

    First, Give a unique ID to the location being linked to. IDs are specified with the id attribute. The value can be hard coded or generated. In the example below, we use the generate-id() XSLT function to generate IDs:

    <fo:block font-weight="bold" font-size="larger" 
     id="{generate-id(.)}" break-before="page">
      <xsl:value-of select="."/>
     </fo:block>
    

    Second, Create the link to that location. As with external links, internal links are created with the tag. The internal-destination attribute should be set to the value of an ID elsewhere in the document.

    <fo:basic-link internal-destination="{generate-id(.)}">
     <xsl:value-of select="."/>
    </fo:basic-link>
    

    I think you missed to include 'url' keyword in 'external-destination' attribute

    0 讨论(0)
提交回复
热议问题