3 my $inputfile = $ARGV[0];
5 print "Now splitting file $inputfile\n";
6 open(IN, "<$inputfile") or die "Error opening file $inputfile";
7 $dummy = <IN>; # <?xml version="1.0" encoding="ISO-8859-1"?>
9 $dummy = <IN>; # <rdf:RDF .../>
10 $where = <IN>; # <h:Object rdf:about="...">
12 $where =~ s/^[^"]*"([^"]*)">$/$1/;
13 while(($line1 = <IN>) && not ($line1 =~ /<\/h:Object>/)) {
14 $line2 = <IN>; # <h:Occurrence>
15 $line3 = <IN>; # <h:position>value</h:position>
16 $line4 = <IN>; # <h:occurrence>value</h:occurrence>
17 $line5 = <IN>; # </h:Occurrence>
18 $line6 = <IN>; # </refObj>
21 $uri =~ s/^[ \t]*<h:occurrence>([^<]*)<\/h:occurrence>$/$1/;
23 $who =~ s/^cic:/backward/;
24 $who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/;
25 $who =~ s/#xpointer\(1\/([^\/]*)\)/,$1/;
26 $line4 =~ s/\Q$uri\E/$where/;
28 open(OUT, ">>$who") or die "Error opening file $who";
29 print OUT "\t\t<h:backPointer>\n";
34 print OUT "\t\t</h:backPointer>\n";