How can I retrieve the favicon of a website with XSLT or JSP?

You could use Google's cache of the favicon:

https://s2.googleusercontent.com/s2/favicons?domain_url=https://example.com


To get the favicon of a website, you need to load the index HTML of each featured website and check for either of the following:

HTML:

<link rel="icon" type="image/vnd.microsoft.icon" href="http://example.com/image.ico">
<link rel="icon" type="image/png" href="http://example.com/image.png">
<link rel="icon" type="image/gif" href="http://example.com/image.gif">

XHTML:

<link rel="icon" type="image/vnd.microsoft.icon" href="/somepath/image.ico" />
<link rel="icon" type="image/png" href="/somepath/image.png" />
<link rel="icon" type="image/gif" href="/somepath/image.gif" />

Internet Explorer may use a slightly different format:

<link rel="SHORTCUT ICON" href="http://www.example.com/myicon.ico" />

Also note that since most web browsers do not require the HTML link to retrieve a favicon, you should also check for favicon.ico in the website's document root, if none of the above link references are found.

With PHP, it is easy to get the HTML contents of a web page by using file_get_contents($url):

$url = 'http://www.exmaple.com';
$output = file_get_contents($url);