[xsl] Re: Display link text as a hyperlink

Subject: [xsl] Re: Display link text as a hyperlink
From: Brent Solly <ultra@xxxxxxxxx>
Date: Thu, 7 Aug 2008 08:29:50 -0700 (PDT)
Date: Wed, 6 Aug 2008 16:00:52 +0100
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Subject: RE: [xsl] Display link text as a hyperlink
Message-ID: <1554B5EB8ECA4B20B917B4BC7A967784@Sealion>

You seem to be using XSLT 2.0 so this is definitely a case for regular
expressions.

I'm always a bit hesitant about pattern matching in the text - you have to
accept that there will be a proportion of wrong matches and that these will
irritate your users. (Microsoft Powerpoint seems to have a nasty habit of
highlighting XPath expressions and regular expressions as URL hyperlinks,
for example). So I think it's important (a) to be careful about it, and (b)
to be conservative.

A reasonable regex might be something like

\s(http://|www)(\.[a-z0-9])+\.(com|org|net|ca|uk|fr|de|...)[^\s]*

but I'm sure one could improve it.

Michael Kay
http://www.saxonica.com/ 

----------------------------------------

I just checked the version that I am using locally and it is XSLT 1.0.  However, the final code is deployed in an XSLT 2.0 environment.  Not sure what to do at this point, because this task may be easier with XSLT 2.0.

Current Thread