7 use Data::Dump qw(dump);
10 my $odt_file = 'contributions.odt';
12 my $xs = XML::Simple->new();
14 use OpenOffice::OODoc 2.101;
15 my $doc = odfDocument(file => $odt_file, create => 'text');
22 family => 'paragraph',
23 # parent => 'Default Style',
27 'fo:text-align' => 'justify'
33 foreach my $file ( glob 'contributions/*.xml' ) {
37 warn "# reading $file\n";
40 open(my $fh, '<:raw', $file);
44 $abstract = $xs->XMLin( $xml, ForceArray => qw(PrimaryAuthor) );
47 warn "# abstract = ", dump($abstract);
49 my $id = $abstract->{'Id'}->[0] || die "no Id in ",dump($abstract);
50 warn "# $id abstract = ", dump($abstract);
52 foreach my $k (qw( ContributionType )) {
53 $stat->{$k}->{ $abstract->{$k}->[0] } ++;
56 my $f = $abstract->{field};
58 push @{ $stat->{_symposium}->{ $f->{1}->{'content'} } }, $id if exists $f->{1}->{content};
59 push @{ $stat->{_theme}->{ $f->{2}->{'content'} } }, $id if exists $f->{2}->{content};
61 $stat->{field}->{ $_ }++ foreach keys %$f;
63 $id2nr->{ $id } = $nr++;
67 my $t = $doc->appendParagraph(text => $abstract->{Title}->[0], style => 'Heading 1');
68 $doc->setPageBreak( $t, position => 'before', style => 'Heading 1');
70 foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
71 $doc->appendParagraph(text => join(' ',
72 map { $a->{$_}->[0] } qw( FirstName FamilyName )
73 ), style => 'Heading 2');
74 $doc->appendParagraph(text => join(' ',
75 map { $a->{$_}->[0] } qw( Affiliation )
76 ), style => 'Heading 3');
77 push @{ $stat->{_Affiliation}->{ $a->{Affiliation}->[0] } }, $id;
80 $doc->appendParagraph(text => $abstract->{Content}->[0], style => 'Abstract');
82 $doc->appendParagraph(text => "\nTheme: " . $abstract->{Theme}->[0], style => 'Theme');
85 $doc->appendParagraph(text => "\nID: " . $abstract->{Id}->[0], style => 'Abstract');
88 warn "# stat = ",dump($stat);
93 open(my $fh, '>', 'affiliation.csv');
94 foreach my $a ( sort keys %{ $stat->{_Affiliation} } ) {
95 print $fh '"',$a,'","',dump( $stat->{_Affiliation}->{$a} ), '"', "\n";