Search

I have text blocks in my XML containing mail addresses, something like:

For further details please contact foo@bar.de

Does anybody know a simple way to link these mail addresses using XSLT so that the result looks like this:

For further details please contact <a href="mailto:foo@bar.de">foo@bar.de</a>

To complicate things: it’s not sure that the addresses are always at the end of the string. Editing the text and linking the mail address directly isn’t an option as it is imported from an external source.

Ideas are welcome. All I can think of seems to be way too complicated.

To answer my own question: I just found Nick’s Twita@talinkahashifyer utility which could easily be adapted.

You can also create your own custom XSLT function via PHP. See more on this article.

Interesting, thanks for the link, Rainer!

Doesn’t Markdown have an option (not necessarily exposed via Text Formatters) to automatically hyperlink or obfuscate emails?

Well, indeed Markdown has this:

<steve@apple.com>

will be: steve@apple.com

However, obfuscation won’t make its way through XSLT. The parser will “de-obfuscate” the characters.

Well, Markdown doesn’t help if a string is pulled from an external source.

Indeed. So Nick’s XSLT seems like a very good place to start.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details