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>/)) {
15 $line3 = <IN>; # </refObj>
18 $uri =~ s/^ *<h:Occurrence rdf:about="[^"]*" rdf:value="([^"]*)"\/>$/$1/;
20 $who =~ s/^cic:/backward/;
21 $who =~ s/#xpointer\(1\/([^\/]*)\/([^\/]*)\)/,$1,$2/;
22 $who =~ s/#xpointer\(1\/([^\/]*)\)/,$1/;
23 $line2 =~ s/\Q$uri\E/$where/;
25 open(OUT, ">>$who") or die "Error opening file $who";
26 print OUT " <h:backPointer>\n";
28 print OUT " </h:backPointer>\n";