I did this a little while ago, with the help of Bob. I marked all the links
that I wanted to convert with a "relative" Role. (This wasn't a problem for
me, as I was already converting the files from another format. If adding an
attribute to all of your relative links is a problem, maybe you could try
and parse href attribute somehow).
This is the customization I have for FO (overriding the fo-external-image
template):
<xsl:template name="fo-external-image">
<xsl:param name="filename"/>
<xsl:choose>
<xsl:when test="$fop.extensions != 0">
<xsl:value-of select="$filename"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="./@role = 'relative'">
<xsl:value-of select="concat('url($prefix, $filename, ')')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('url(', $filename, ')')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Hope this helps!
Nat
On Wed, Jun 11, 2014 at 4:43 AM, Phillip Kent <[email protected]>
wrote:
> Dear all,
>
> I would be really grateful for a steer on the following. I can see that
> customizing the 'href.target' template is part of the answer but can't
> find an example that is close to what I need.
>
> I have a DocBook5 article which outputs to both html and fo/pdf. The
> html is 'trimmed' to body only and dropped into a node of my company's
> Drupal CMS corporate website. The pdf is uploaded to the website and
> offered as optional download.
>
> I have two kinds of links to webpages/websites: one is internal, like
> this:
>
> <link
> xlink:href="/main/knowledge-centre/library/how-create-vm-from-iso">How
> to create a VM by booting from an ISO</link>
>
> Drupal fills in the full URL here. One reason I don't type the full URL
> in the xml source is because there are webservers, a development server
> and a production server, and it's helpful if the same link works on
> both, which it does nicely.
>
> The other type of links are just simple external links, such as:
> <link xlink:href="http://www.docbook.org">Created with DocBook</link>
>
> So here is my question: in the fo/pdf output I want every <link> to be
> converted to a hyperlink within the pdf, with me having some control
> over the formatting of the link text.
>
> This means for internal links I need to prepend the rest of the website
> URL.
>
> And for external links only, I would like the URL to also appear as a
> footnote.
>
> I appreciate your suggestions... Phillip
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>