in reply to XML::Twig - extracting some tags from siblings
You can't do that with a simple condition. The simplest is probably to do something like (untested):
my @sheads= $t->root->children( 'shead'); foreach my $shead (@sheads) { my $aheadtext= $shead->wrap_in( 'aheadtext'); my $more_text= $aheadtext->next_sibling; while( $more_text->tag ne 'shead') { $more_text->move( last_child => $aheadtext); $more_text= $aheadtext->next_sibling; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig - extracting some tags from siblings
by aakikce (Acolyte) on Jun 05, 2007 at 14:57 UTC | |
by mirod (Canon) on Jun 05, 2007 at 15:34 UTC |