--- /dev/null
+#!/usr/bin/perl
+use autodie;
+use warnings;
+use strict;
+
+use XML::Simple;
+use Data::Dump qw(dump);
+use utf8;
+
+my $odt_file = 'contributions.odt';
+
+my $xs = XML::Simple->new();
+
+use OpenOffice::OODoc 2.101;
+my $doc = odfDocument(file => $odt_file, create => 'text');
+
+my $stat;
+my $id2nr;
+
+$doc->createStyle(
+ "Abstract",
+ family => 'paragraph',
+# parent => 'Default Style',
+# category => 'auto',
+ properties => {
+ -area => 'paragraph',
+ 'fo:text-align' => 'justify'
+ }
+);
+
+
+my $nr = 0;
+foreach my $file ( glob 'contributions/*.xml' ) {
+
+ my $abstract;
+
+ warn "# reading $file\n";
+
+ {
+ open(my $fh, '<:raw', $file);
+ local $/ = undef;
+ my $xml = <$fh>;
+# warn dump($xml);
+ $abstract = $xs->XMLin( $xml, ForceArray => qw(PrimaryAuthor) );
+ }
+
+ warn "# abstract = ", dump($abstract);
+
+ my $id = $abstract->{'Id'}->[0] || die "no Id in ",dump($abstract);
+ warn "# $id abstract = ", dump($abstract);
+
+ foreach my $k (qw( ContributionType )) {
+ $stat->{$k}->{ $abstract->{$k}->[0] } ++;
+ }
+
+ my $f = $abstract->{field};
+
+ push @{ $stat->{_symposium}->{ $f->{1}->{'content'} } }, $id if exists $f->{1}->{content};
+ push @{ $stat->{_theme}->{ $f->{2}->{'content'} } }, $id if exists $f->{2}->{content};
+
+ $stat->{field}->{ $_ }++ foreach keys %$f;
+
+ $id2nr->{ $id } = $nr++;
+
+warn "$nr";
+
+ my $t = $doc->appendParagraph(text => $abstract->{Title}->[0], style => 'Heading 1');
+ $doc->setPageBreak( $t, position => 'before', style => 'Heading 1');
+
+ foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
+ $doc->appendParagraph(text => join(' ',
+ map { $a->{$_}->[0] } qw( FirstName FamilyName )
+ ), style => 'Heading 2');
+ $doc->appendParagraph(text => join(' ',
+ map { $a->{$_}->[0] } qw( Affiliation )
+ ), style => 'Heading 3');
+ push @{ $stat->{_Affiliation}->{ $a->{Affiliation}->[0] } }, $id;
+ }
+
+ $doc->appendParagraph(text => $abstract->{Content}->[0], style => 'Abstract');
+
+ $doc->appendParagraph(text => "\nTheme: " . $abstract->{Theme}->[0], style => 'Theme');
+
+
+ $doc->appendParagraph(text => "\nID: " . $abstract->{Id}->[0], style => 'Abstract');
+}
+
+warn "# stat = ",dump($stat);
+
+$doc->save;
+
+
+open(my $fh, '>', 'affiliation.csv');
+foreach my $a ( sort keys %{ $stat->{_Affiliation} } ) {
+ print $fh '"',$a,'","',dump( $stat->{_Affiliation}->{$a} ), '"', "\n";
+}
+