From: Wolfram Schneider Date: Thu, 8 Apr 2010 09:50:33 +0000 (+0000) Subject: a real test script X-Git-Tag: CPAN-v1.02~54^2~93^2~27 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=53e9b5bbf0ce7d1065963c6d9ad4b0dcacce2cdf;p=irspy-moved-to-github.git a real test script - allow to configure the xslt sheet - parse more than one xml file --- diff --git a/bin/irspy_xsltproc.pl b/bin/irspy_xsltproc.pl index 03e641d..8f37204 100755 --- a/bin/irspy_xsltproc.pl +++ b/bin/irspy_xsltproc.pl @@ -1,28 +1,55 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl -# $Id: irspy_xsltproc.pl,v 1.4 2007-06-28 13:57:53 sondberg Exp $ -# ------------------------------------------------------------------ # This script is only for debugging purposes - it takes a raw IRspy # xml output document as argument and executes the irspy2zeerex.xsl # transformation right in front of you: # -# ./irspy_xsltproc.pl irspy_output_raw.xml -# +# ./irspy_xsltproc.pl irspy_output_raw.xml ... -use strict; -use warnings; +use Getopt::Long; +use Data::Dumper; use lib '../lib'; use ZOOM::IRSpy; -if (@ARGV && $ARGV[0] eq "-d") { - shift; - XML::LibXSLT->debug_callback(\&xslt_debug); +use strict; + +#use warnings; + +sub usage { + + < \$xslt_debug, + "v" => \$verbose, + "f=s" => \$irspy_to_zeerex_xsl, +); + +die usage if $#ARGV < 0; +XML::LibXSLT->debug_callback( \&xslt_debug ) if defined $xslt_debug; + +$ZOOM::IRSpy::irspy_to_zeerex_xsl = $irspy_to_zeerex_xsl + if $irspy_to_zeerex_xsl; + my $dbname = 'localhost:8018/IR-Explain---1'; -my $spy = new ZOOM::IRSpy($dbname, "admin", "fruitbat"); -my $source_file = shift || die("$0: Please specify xml instance file"); -my $source_doc = $spy->{libxml}->parse_file($source_file); -my $results = $spy->{irspy_to_zeerex_style}->transform($source_doc); +my $spy = new ZOOM::IRSpy( $dbname, "admin", "fruitbat" ); + +warn Dumper($spy) if $verbose; +foreach my $source_file (@ARGV) { + my $source_doc = $spy->{libxml}->parse_file($source_file); + my $results = $spy->{irspy_to_zeerex_style}->transform($source_doc); + + print $results->toString(1); +} -print $results->toString(1);