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 if ( my $s = $abstract->{Symposium_title} ) {
58 push @{ $stat->{_symposium}->{$s} }, $id;
61 my $f = $abstract->{field};
63 push @{ $stat->{_symposium}->{ $f->{1}->{'content'} } }, $id if exists $f->{1}->{content};
64 push @{ $stat->{_theme}->{ $f->{2}->{'content'} } }, $id if exists $f->{2}->{content};
66 $stat->{field}->{ $_ }++ foreach keys %$f;
68 $id2nr->{ $id } = $nr++;
72 warn "# stat = ",dump($stat);
78 my $t = $doc->appendParagraph(text => $abstract->{Title}->[0], style => 'Heading 1');
79 $doc->setPageBreak( $t, position => 'before', style => 'Heading 1');
81 foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
82 $doc->appendParagraph(text => join(' ',
83 map { $a->{$_}->[0] } qw( FirstName FamilyName )
84 ), style => 'Heading 2');
85 $doc->appendParagraph(text => join(' ',
86 map { $a->{$_}->[0] } qw( Affiliation )
87 ), style => 'Heading 3');
88 push @{ $stat->{_Affiliation}->{ $a->{Affiliation}->[0] } }, $id;
91 # $doc->appendParagraph(text => $abstract->{Content}->[0], style => 'Abstract');
92 foreach my $p ( split(/[\n\r]+/, $abstract->{Content}->[0] ) ) {
93 $doc->appendParagraph(text => $p, style => 'Abstract');
96 $doc->appendParagraph(text => "\nTheme: " . $abstract->{Theme}->[0], style => 'Theme');
99 $doc->appendParagraph(text => "\nID: " . $abstract->{Id}->[0], style => 'Abstract');
102 warn "# stat = ",dump($stat);
107 open(my $fh, '>', 'affiliation.csv');
108 foreach my $a ( sort keys %{ $stat->{_Affiliation} } ) {
109 print $fh '"',$a,'","',dump( $stat->{_Affiliation}->{$a} ), '"', "\n";
113 "Symposium proposal" => 12,
114 "Symposium abstract" => 52,
115 "Oral presentation" => 141,
116 "Poster presentation" => 71,