#!/bin/perl -w

#########################################################################
#                                                                       #
#  This example shows how to use the twig_print_outside_roots option    #
#  It deletes a statistical category from the document                  #
#                                                                       #
#########################################################################

use strict;
use XML::Twig;

my $field= $ARGV[0] || 'ppg';
                                              # twig will be created only
                                              # for $field elements
my $twig= new XML::Twig( twig_roots    => { $field => 1 },
                                              # print all other elements asis
                         twig_print_outside_roots => 1, 
                         twig_handlers => { $field => \&field } ); 

$twig->parsefile( "nba.xml");                 # parse the twig

sub field
  { my( $twig, $field)= @_;                      
    $field->cut;    
 }

