Input:

a

b

c
Output:

a

b

c
#### if ($b->get_xpath("//table")) { foreach my $table ($b->get_xpath("//table")) { if ($table->get_xpath("thead")) { foreach my $thead ($table->get_xpath("thead")) { if ($thead->get_xpath("ROW")) { foreach my $row ($thead->get_xpath("ROW")) { if ($row->get_xpath("ENTRY")) { foreach my $entry ($row->get_xpath("ENTRY")) { if ($entry->att("colspan")) { my $colspan= $entry->att("colspan"); my $cl=$colspan - 1; while ($cl--) { my $elt=new XML::Twig::Elt("ENTRY","DELETE"); $elt->paste(after=>$entry); } } } } } if ($thead->get_xpath("ROW")) { foreach my $row ($thead->get_xpath("ROW")) { if ($row->get_xpath("ENTRY")) { foreach my $entry ($row->get_xpath("ENTRY")) { my $colpl=$entry->prev_siblings("ENTRY"); if ($entry->att("rowspan")) { my $rowspan= $entry->att("rowspan"); my $rw=$rowspan - 1; my $temp=$row; while ($rw--) { $temp=$temp->next_sibling("ROW"); my $elt=new XML::Twig::Elt("ENTRY","RDELETE"); my $t; if ($colpl) { $t=$colpl; my @t=$temp->children; my ($place)=$temp->get_xpath("ENTRY[$t]"); $elt->paste(after=>$place); } else { $t=1; my ($place)=$temp->get_xpath("ENTRY[$t]"); $elt->paste(before=>$place); }; } } } foreach my $entry ($row->get_xpath("ENTRY")) { if (grep{/colspan/i}$entry->att_names) { my $p=$entry->att("colspan"); my $colpl=$entry->prev_siblings("ENTRY"); $entry->set_atts({"colstart"=>$colpl+1,"colend"=>$colpl+$p}); $entry->del_att("colspan"); } } foreach my $entry ($row->get_xpath("ENTRY")) { if ($entry->text=~/^R?DELETE$/) { $entry->delete; } } } } } } } } } }