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' ) {
36 open(my $fh, '<', 'contributions/all.xml');
43 foreach my $xml ( split(/\Q<?xml\E/, $xml) ) {
47 $xml = '<?xml' . $xml;
53 $abstract = $xs->XMLin( $xml, ForceArray => qw(PrimaryAuthor) );
55 warn "# abstract = ", dump($abstract);
57 my $id = $abstract->{'Id'}->[0] || die "no Id in ",dump($abstract);
58 warn "# $id abstract = ", dump($abstract);
60 foreach my $k (qw( ContributionType )) {
61 $stat->{$k}->{ $abstract->{$k}->[0] } ++;
64 if ( my $s = $abstract->{Symposium_title} ) {
66 push @{ $stat->{_symposium}->{$s} }, $id;
69 my $f = $abstract->{field};
71 push @{ $stat->{_symposium}->{ $f->{1}->{'content'} } }, $id if exists $f->{1}->{content};
72 push @{ $stat->{_theme}->{ $f->{2}->{'content'} } }, $id if exists $f->{2}->{content};
74 $stat->{field}->{ $_ }++ foreach keys %$f;
76 $id2nr->{ $id } = $nr++;
80 warn "# stat = ",dump($stat);
86 my $t = $doc->appendParagraph(text => $abstract->{Title}->[0], style => 'Heading 1');
87 $doc->setPageBreak( $t, position => 'before', style => 'Heading 1');
89 foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
90 $doc->appendParagraph(text => join(' ',
91 map { $a->{$_}->[0] } qw( FirstName FamilyName )
92 ), style => 'Heading 2');
93 $doc->appendParagraph(text => join(' ',
94 map { $a->{$_}->[0] } qw( Affiliation )
95 ), style => 'Heading 3');
96 push @{ $stat->{_Affiliation}->{ $a->{Affiliation}->[0] } }, $id;
99 # $doc->appendParagraph(text => $abstract->{Content}->[0], style => 'Abstract');
100 foreach my $p ( split(/[\n\r]+/, $abstract->{Content}->[0] ) ) {
101 $doc->appendParagraph(text => $p, style => 'Abstract');
104 $doc->appendParagraph(text => "\nTheme: " . $abstract->{Theme}->[0], style => 'Theme');
107 $doc->appendParagraph(text => "\nID: " . $abstract->{Id}->[0], style => 'Abstract');
110 warn "# stat = ",dump($stat);
115 open(my $fh, '>', 'affiliation.csv');
116 foreach my $a ( sort keys %{ $stat->{_Affiliation} } ) {
117 print $fh '"',$a,'","',dump( $stat->{_Affiliation}->{$a} ), '"', "\n";
121 "Symposium proposal" => 12,
122 "Symposium abstract" => 52,
123 "Oral presentation" => 141,
124 "Poster presentation" => 71,