RE: [xsl] to generate a HOT-LINK in the HTML and FO outputs for all text that matches http://... URL syntax

Subject: RE: [xsl] to generate a HOT-LINK in the HTML and FO outputs for all text that matches http://... URL syntax
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 18 Sep 2003 12:41:07 +0300
Hi,

> Can anyone suggest a small stylesheet/piece of code that 
> generates a hot
> link for any and every piece of content being transformed by the XSL
> into HTML as well as FO?
> 
> I do know what tags are to be created.
> 
> The issue is I DO NOT KNOW where in the content for the entire 50 page
> document these http:// will occur.
> 
> They can be immersed anywhere in the content in any node, at 
> any level,
> in any ELEMENT of the tree. (not in attributes).
> 
> At the moment the output into HTML is as plain text http://...
> 
> How can I write a stylesheet that ca EASILY plug-in to the current
> stylesheets and find and process those parts of the content 
> from a plain
> vanilla http://xxxxxxx to <a href = "http://xxxxx>http://xxxxx</a> 
> 
> That kind of processing template/function/expression ??

Write a template for text nodes, which tests if the text contains the string 'http://' and then using XPath string manipulation functions replace the link text with an element that contains the link. Write a recursive one, so that if a single text node contains multiple URLs, all get transformed. Come back to us if you have problems in writing the stylesheet.

Cheers,

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread