use make variables
[irspy-moved-to-github.git] / bin / irspy_xsltproc.pl
1 #!/usr/bin/perl
2
3 # This script is only for debugging purposes - it takes a raw IRspy
4 # xml output document as argument and executes the irspy2zeerex.xsl
5 # transformation right in front of you:
6 #
7 # ./irspy_xsltproc.pl irspy_output_raw.xml ...
8
9 use Getopt::Long;
10 use Data::Dumper;
11 use lib '../lib';
12 use ZOOM::IRSpy;
13
14 use strict;
15
16 #use warnings;
17
18 sub usage {
19
20     <<EOF
21 usage $0 [ options ] file.xml ...
22
23 -d              enable xslt debug
24 -v              verbose level
25 -f irspy.xsl    set irspy_to_zeerex_xsl
26 EOF
27 }
28
29 my $irspy_to_zeerex_xsl;
30 my $xslt_debug;
31 my $verbose = 0;
32
33 GetOptions(
34     "d"   => \$xslt_debug,
35     "v"   => \$verbose,
36     "f=s" => \$irspy_to_zeerex_xsl,
37 );
38
39 die usage if $#ARGV < 0;
40 XML::LibXSLT->debug_callback( \&xslt_debug ) if defined $xslt_debug;
41
42 $ZOOM::IRSpy::irspy_to_zeerex_xsl = $irspy_to_zeerex_xsl
43   if $irspy_to_zeerex_xsl;
44
45 my $dbname = 'localhost:8018/IR-Explain---1';
46 my $spy = new ZOOM::IRSpy( $dbname, "admin", "fruitbat" );
47
48 warn Dumper($spy) if $verbose;
49 foreach my $source_file (@ARGV) {
50     my $source_doc = $spy->{libxml}->parse_file($source_file);
51     my $results    = $spy->{irspy_to_zeerex_style}->transform($source_doc);
52
53     print $results->toString(1);
54 }
55