title: Apache FOP - render hyperlinks to PDF
body: <p>I got a xml file with several blocks of text and lists. This will be rendered to a pdf using Apache FOP via a xsl transformation. The xsl is working however inside the xml are links defined like this <code>[abc|www.abc.com]</code> which should result in a link with abc as shown and www.abc.com as target.</p>
  
  <p>The xsl equivalent would be this:
  <code>&lt;fo:basic-link external-destination="www.abc.com" show-destination="new"&gt;abc&lt;/fo:basic-link&gt;</code></p>
  
  <p>However this links are inside text blocks and I do not know when they occure and when not. So what I need is a way to catch that and stuff and bring it into a form like the above where i do not know how would you do this in XSL? </p>
  
  <p>A second way would be to implement some custom behaviour to the renderer but that could need a lot effort and i don't know where to hack in here.</p>
  
  <p>Example input:</p>
  
  <pre><code>&lt;fields&gt;
    &lt;field1&gt;
     This is an example blog which contains the link [abc|www.abc.com] on a
     random position and it can contain a second link [abc2|www.abc2.com] like this
    &lt;/field1&gt;
  &lt;fields&gt;
  </code></pre>
  
  <p>Desired output:</p>
  
  <p><strong>Field1:</strong>
  This is an example blog which contains the link <a href="http://abc.de" rel="nofollow" title="abc">abc</a> on a
  random position and it can contain a second link <a href="http://abc2.de" rel="nofollow" title="abc2">abc2</a> like this</p>