use Web::Query::LibXML qw(); my $w = Web::Query->new_from_html(<<'HTML'); <body> … HTML $w->find('blockquote p')->each(sub { my @parts = split ' ', $_->text; if (@parts > 1) { for my $p (reverse @parts) { $_->after("<p>$p</p>"); } $_->remove; } }); print $w->as_html; __END__ … <blockquote id="two"><p>ddd</p><p>eee</p><p>fff</p></blockquote> …
In reply to Re: Replacing an HTML element with multiple elements using HTML::TreeBuilder
by daxim
in thread Replacing an HTML element with multiple elements using HTML::TreeBuilder
by mldvx4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |