Log XML2/XSLT errors to yaz_log
[idzebra-moved-to-github.git] / test / dmoz / con1.pl
1 #!/usr/bin/perl -w
2
3 my $state = 'init';
4 my $topic = '';
5 my $title = '';
6 my $description;
7
8 while ($_ = <STDIN>) {
9     if (/<Topic r:id=\"(.*?)\">/) {
10         $topic = $1;
11     }
12     elsif (/<ExternalPage about=\"(.*?)\">/) {
13         $url = $1;
14     }
15     elsif (/<d:Title>(.*?)<\/d:Title>/) {
16         $title = $1;
17     }
18     elsif (/<d:Description>(.*?)<\/d:Description>/) {
19         $description = $1;
20     }
21     elsif (/<\/ExternalPage>/) {
22         if (length($title) > 0) 
23         {
24             print "<meta>\n";
25             print " <title>$title</title>\n";
26             print " <description>$description</description>\n";
27             print " <url>$url</url>\n";
28             print " <topic>$topic</topic>\n";
29             print "</meta>\n";
30         }
31     }
32 }