in reply to Extracting stylesheet links or url from HTML Page

This may do. Lightly tested. XML::LibXML seems to normalize attribute names to lowercase. (update: cleaned up loop a little.)

use warnings; use strict; use XML::LibXML; my $parser = XML::LibXML->new; $parser->recover_silently(1); my $doc = $parser->parse_html_file(+shift||die "give an HTML file\n"); for my $link ( $doc->findnodes('//link[@rel]') ) { next unless lc($link->getAttribute("rel")) eq "stylesheet"; print $link->getAttribute("href"), $/; }

Replies are listed 'Best First'.
Re^2: Extracting stylesheet links or url from HTML Page
by runrig (Abbot) on Aug 15, 2011 at 18:54 UTC
    The 'stylesheet' constraint could have been put straight into the XPath:
    $doc->findnodes( q(//link[@rel='stylesheet']) )