#!/usr/bin/perl
use strict;

  use XML::LibXSLT;
  use XML::LibXML;

  my $parser = XML::LibXML->new();
  my $xslt = XML::LibXSLT->new();

        my $data_path = '/home/sitnikov/public_html/xslt-benchmark/data/';
        my $file = 'netinfo1';

        $file = $1 if $ENV{'QUERY_STRING'} =~ /^([a-z0-9_-]+)$/;

  my $source = $parser->parse_file($data_path.$file.'.xml');
  my $style_doc = $parser->parse_file($data_path.$file.'.xsl');

  my $stylesheet = $xslt->parse_stylesheet($style_doc);


  my $results = $stylesheet->transform($source);

        print "Content-Type: text/html\n\n";

  print $stylesheet->output_string($results);