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"), $/; }
In reply to Re: Extracting stylesheet links or url from HTML Page
by Your Mother
in thread Extracting stylesheet links or url from HTML Page
by mr_p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |